From: Matt Johnston <matt@codeconstruct.com.au>
To: Jeremy Kerr <jk@codeconstruct.com.au>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>,
Paolo Abeni <pabeni@redhat.com>, Wolfram Sang <wsa@kernel.org>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
Andrew Jeffery <andrew@codeconstruct.com.au>,
Matt Johnston <matt@codeconstruct.com.au>
Subject: [PATCH net-next] mctp i2c: initialise event handler read bytes
Date: Tue, 13 Jan 2026 17:01:16 +0800 [thread overview]
Message-ID: <20260113-mctp-read-fix-v1-1-70c4b59c741c@codeconstruct.com.au> (raw)
Set a 0xff value for i2c reads of an mctp-i2c device. Otherwise reads
will return "val" from the i2c bus driver. For i2c-aspeed and
i2c-npcm7xx that is a stack uninitialised u8.
Tested with "i2ctransfer -y 1 r10@0x34" where 0x34 is a mctp-i2c
instance, now it returns all 0xff.
Fixes: f5b8abf9fc3d ("mctp i2c: MCTP I2C binding driver")
Signed-off-by: Matt Johnston <matt@codeconstruct.com.au>
---
I'm targeting net-next since this depends on the just-committed fix
from Jian Zhang
ae4744e173fa ("net: mctp-i2c: fix duplicate reception of old data")
That patch and this one should both be applied to stable - will that
happen automatically with "Fixes:"?
Thanks,
Matt
---
drivers/net/mctp/mctp-i2c.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/net/mctp/mctp-i2c.c b/drivers/net/mctp/mctp-i2c.c
index ecda1cc36391ce50a6b28e6a9e13c3b344f8f993..8043b57bdf25095b3b4e6bacd3abbc6f8952acfe 100644
--- a/drivers/net/mctp/mctp-i2c.c
+++ b/drivers/net/mctp/mctp-i2c.c
@@ -243,7 +243,10 @@ static int mctp_i2c_slave_cb(struct i2c_client *client,
switch (event) {
case I2C_SLAVE_READ_REQUESTED:
+ case I2C_SLAVE_READ_PROCESSED:
+ /* MCTP I2C transport only uses writes */
midev->rx_pos = 0;
+ *val = 0xff;
break;
case I2C_SLAVE_WRITE_RECEIVED:
if (midev->rx_pos < MCTP_I2C_BUFSZ) {
---
base-commit: f10c325a345fef0a688a2bcdfab1540d1c924148
change-id: 20260113-mctp-read-fix-e191357ad049
prerequisite-message-id: <20260108101829.1140448-1-zhangjian.3032@bytedance.com>
prerequisite-patch-id: 0765450364f2e9f65f6f3940d4a45598763aae8c
Best regards,
--
Matt Johnston <matt@codeconstruct.com.au>
next reply other threads:[~2026-01-13 9:01 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-13 9:01 Matt Johnston [this message]
2026-01-19 14:19 ` patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260113-mctp-read-fix-v1-1-70c4b59c741c@codeconstruct.com.au \
--to=matt@codeconstruct.com.au \
--cc=andrew+netdev@lunn.ch \
--cc=andrew@codeconstruct.com.au \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=jk@codeconstruct.com.au \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=wsa@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®