Commit cf1ed2c5 authored by Tomas Winkler's avatar Tomas Winkler Committed by Greg Kroah-Hartman

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 <dan.carpenter@oracle.com>
Fixes: 9078ad92ef86 ("mei: expose fw version to sysfs")
Signed-off-by: default avatarTomas Winkler <tomas.winkler@intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent b40b3e93
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment