]> Git Repo - J-linux.git/commitdiff
drm/i915/display: Fix an unsigned subtraction which can never be negative.
authorHarshit Mogalapalli <[email protected]>
Fri, 10 Dec 2021 04:41:24 +0000 (20:41 -0800)
committerRodrigo Vivi <[email protected]>
Tue, 14 Dec 2021 09:11:10 +0000 (04:11 -0500)
smatch warning:
drivers/gpu/drm/i915/display/intel_dmc.c:601 parse_dmc_fw() warn:
unsigned 'fw->size - offset' is never less than zero

Firmware size is size_t and offset is u32. So the subtraction is
unsigned which can never be less than zero.

Fixes: 3d5928a168a9 ("drm/i915/xelpd: Pipe A DMC plugging")
Signed-off-by: Harshit Mogalapalli <[email protected]>
Reviewed-by: Lucas De Marchi <[email protected]>
Signed-off-by: Lucas De Marchi <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
(cherry picked from commit 87bb2a410dcfb617b88e4695edf4beb6336dc314)
Signed-off-by: Rodrigo Vivi <[email protected]>
drivers/gpu/drm/i915/display/intel_dmc.c

index 2dc9d632969dbca821d4ec7d2f2d5f91aa6df422..aef69522f0be3db0cc626078c6ff9e387a7cbeb8 100644 (file)
@@ -596,7 +596,7 @@ static void parse_dmc_fw(struct drm_i915_private *dev_priv,
                        continue;
 
                offset = readcount + dmc->dmc_info[id].dmc_offset * 4;
-               if (fw->size - offset < 0) {
+               if (offset > fw->size) {
                        drm_err(&dev_priv->drm, "Reading beyond the fw_size\n");
                        continue;
                }
This page took 0.061462 seconds and 4 git commands to generate.