Skip to content

Commit 2f9cd85

Browse files
Dan Carpentergregkh
authored andcommitted
drm/panel: type promotion bug in s6e8aa0_read_mtp_id()
[ Upstream commit cd0e0ca ] The ARRAY_SIZE() macro is type size_t. If s6e8aa0_dcs_read() returns a negative error code, then "ret < ARRAY_SIZE(id)" is false because the negative error code is type promoted to a high positive value. Fixes: 02051ca ("drm/panel: add S6E8AA0 driver") Signed-off-by: Dan Carpenter <[email protected]> Reviewed-by: Andrzej Hajda <[email protected]> Signed-off-by: Thierry Reding <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected] Signed-off-by: Sasha Levin <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 2c7de6d commit 2f9cd85

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/gpu/drm/panel/panel-samsung-s6e8aa0.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -823,7 +823,7 @@ static void s6e8aa0_read_mtp_id(struct s6e8aa0 *ctx)
823823
int ret, i;
824824

825825
ret = s6e8aa0_dcs_read(ctx, 0xd1, id, ARRAY_SIZE(id));
826-
if (ret < ARRAY_SIZE(id) || id[0] == 0x00) {
826+
if (ret < 0 || ret < ARRAY_SIZE(id) || id[0] == 0x00) {
827827
dev_err(ctx->dev, "read id failed\n");
828828
ctx->error = -EIO;
829829
return;

0 commit comments

Comments
 (0)