Skip to content

Commit 87bb2a4

Browse files
harshimogalapallilucasdemarchi
authored andcommitted
drm/i915/display: Fix an unsigned subtraction which can never be negative.
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: 3d5928a ("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]
1 parent 6306d8d commit 87bb2a4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/gpu/drm/i915/display/intel_dmc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -598,7 +598,7 @@ static void parse_dmc_fw(struct drm_i915_private *dev_priv,
598598
continue;
599599

600600
offset = readcount + dmc->dmc_info[id].dmc_offset * 4;
601-
if (fw->size - offset < 0) {
601+
if (offset > fw->size) {
602602
drm_err(&dev_priv->drm, "Reading beyond the fw_size\n");
603603
continue;
604604
}

0 commit comments

Comments
 (0)