Skip to content

Commit 53b3495

Browse files
harshimogalapallirodrigovivi
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] (cherry picked from commit 87bb2a4) Signed-off-by: Rodrigo Vivi <[email protected]>
1 parent 2585cf9 commit 53b3495

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
@@ -596,7 +596,7 @@ static void parse_dmc_fw(struct drm_i915_private *dev_priv,
596596
continue;
597597

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

0 commit comments

Comments
 (0)