mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] mei: bus-fixup: fix data_size in NFC interface version request
@ 2026-12-03 11:42 Haoran Wang
  2026-12-03 11:58 ` Usyskin, Alexander
  0 siblings, 1 reply; 2+ messages in thread
From: Haoran Wang @ 2026-12-03 11:42 UTC (permalink / raw)
  To: Alexander Usyskin; +Cc: Greg Kroah-Hartman, Arnd Bergmann, linux-kernel

mei_nfc_if_version() sets .data_size = 1 but sends the command with
sizeof(cmd), which excludes the flexible array member data[], so the
firmware is told to consume a payload byte that the kernel never sends.
IF_VERSION carries no payload, so set data_size to 0 to match the
actual message length, as the reply side already treats data[] as the
payload.

This was found by static analysis and the trigger is theoretical,
since the kernel never sends the declared payload byte.

Fixes: b39910c2e0ac ("mei: bus: simplify how we build nfc bus name")
Signed-off-by: Haoran Wang <haoranwangsec@gmail.com>
---
 drivers/misc/mei/bus-fixup.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/misc/mei/bus-fixup.c b/drivers/misc/mei/bus-fixup.c
index bea7a47d216e..59daeddeab55 100644
--- a/drivers/misc/mei/bus-fixup.c
+++ b/drivers/misc/mei/bus-fixup.c
@@ -371,7 +371,7 @@ static int mei_nfc_if_version(struct mei_cl *cl,
 	struct mei_device *bus;
 	struct mei_nfc_cmd cmd = {
 		.command = MEI_NFC_CMD_MAINTENANCE,
-		.data_size = 1,
+		.data_size = 0,
 		.sub_command = MEI_NFC_SUBCMD_IF_VERSION,
 	};
 	struct mei_nfc_reply *reply = NULL;

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-12-03 11:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-12-03 11:42 [PATCH] mei: bus-fixup: fix data_size in NFC interface version request Haoran Wang
2026-12-03 11:58 ` Usyskin, Alexander

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®