Skip to content

Commit 582ab27

Browse files
ausyskingregkh
authored andcommitted
mei: bus: fix received data size check in NFC fixup
NFC version reply size checked against only header size, not against full message size. That may lead potentially to uninitialized memory access in version data. That leads to warnings when version data is accessed: drivers/misc/mei/bus-fixup.c: warning: '*((void *)&ver+11)' may be used uninitialized in this function [-Wuninitialized]: => 212:2 Reported in Build regressions/improvements in v4.9-rc3 https://lkml.org/lkml/2016/10/30/57 Fixes: 59fcd7c (mei: nfc: Initial nfc implementation) Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com> Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent a909d3e commit 582ab27

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

drivers/misc/mei/bus-fixup.c

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

179179
ret = 0;
180180
bytes_recv = __mei_cl_recv(cl, (u8 *)reply, if_version_length);
181-
if (bytes_recv < 0 || bytes_recv < sizeof(struct mei_nfc_reply)) {
181+
if (bytes_recv < if_version_length) {
182182
dev_err(bus->dev, "Could not read IF version\n");
183183
ret = -EIO;
184184
goto err;

drivers/nfc/mei_phy.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ static int mei_nfc_if_version(struct nfc_mei_phy *phy)
133133
return -ENOMEM;
134134

135135
bytes_recv = mei_cldev_recv(phy->cldev, (u8 *)reply, if_version_length);
136-
if (bytes_recv < 0 || bytes_recv < sizeof(struct mei_nfc_reply)) {
136+
if (bytes_recv < 0 || bytes_recv < if_version_length) {
137137
pr_err("Could not read IF version\n");
138138
r = -EIO;
139139
goto err;

0 commit comments

Comments
 (0)