Skip to content

Commit 29068d2

Browse files
Dan Carpentergregkh
authored andcommitted
mei: bus: type promotion bug in mei_nfc_if_version()
commit b40b3e9 upstream. We accidentally removed the check for negative returns without considering the issue of type promotion. The "if_version_length" variable is type size_t so if __mei_cl_recv() returns a negative then "bytes_recv" is type promoted to a high positive value and treated as success. Cc: <[email protected]> Fixes: 582ab27 ("mei: bus: fix received data size check in NFC fixup") Signed-off-by: Dan Carpenter <[email protected]> Signed-off-by: Tomas Winkler <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 0eb82af commit 29068d2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/misc/mei/bus-fixup.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ static int mei_nfc_if_version(struct mei_cl *cl,
267267

268268
ret = 0;
269269
bytes_recv = __mei_cl_recv(cl, (u8 *)reply, if_version_length, 0);
270-
if (bytes_recv < if_version_length) {
270+
if (bytes_recv < 0 || bytes_recv < if_version_length) {
271271
dev_err(bus->dev, "Could not read IF version\n");
272272
ret = -EIO;
273273
goto err;

0 commit comments

Comments
 (0)