aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomas Winkler <[email protected]>2018-07-11 15:29:32 +0300
committerGreg Kroah-Hartman <[email protected]>2018-07-12 15:44:57 +0200
commitcf1ed2c59b982d892b7c4d25b3dea2421cc5aa08 (patch)
tree966299b348b9e1703e630886dc05936eb0c332bc
parentb40b3e9358fbafff6a4ba0f4b9658f6617146f9c (diff)
mei: bus: type promotion bug in mei_fwver()
if __mei_cl_recv() returns a negative then "bytes_recv" type is promoted to a high positive value in comparison with size_t evaluated by MKHI_FWVER_LEN(1). It results in error condition not to be detected. Cc: Dan Carpenter <[email protected]> Fixes: 9078ad92ef86 ("mei: expose fw version to sysfs") Signed-off-by: Tomas Winkler <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
-rw-r--r--drivers/misc/mei/bus-fixup.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/misc/mei/bus-fixup.c b/drivers/misc/mei/bus-fixup.c
index 65e28be3c8cc..4c232f0eae90 100644
--- a/drivers/misc/mei/bus-fixup.c
+++ b/drivers/misc/mei/bus-fixup.c
@@ -181,7 +181,7 @@ static int mei_fwver(struct mei_cl_device *cldev)
ret = 0;
bytes_recv = __mei_cl_recv(cldev->cl, buf, sizeof(buf), 0,
MKHI_RCV_TIMEOUT);
- if (bytes_recv < MKHI_FWVER_LEN(1)) {
+ if (bytes_recv < 0 || bytes_recv < MKHI_FWVER_LEN(1)) {
/*
* Should be at least one version block,
* error out if nothing found