The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Corey Minyard <corey@minyard.net>
To: Eric Yun Lin Chiang <ericyunlinchiang@gmail.com>,
	Asmaa Mnebhi <Asmaa@mellanox.com>
Cc: openipmi-developer@lists.sourceforge.net,
	linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH] ipmi: ipmb_dev_int: initialise event handler read bytes
Date: Sun, 6 Dec 2026 07:54:17 -0600	[thread overview]
Message-ID: <axVpCcNOikGMRABD@mail.minyard.net> (raw)
In-Reply-To: <20261203063440.3753378-1-ericyunlinchiang@gmail.com>

On Thu, Dec 03, 2026 at 02:34:40PM +0800, Eric Yun Lin Chiang wrote:
> IPMB does not use i2c reads, but ipmb_slave_cb() still has to set *val
> on I2C_SLAVE_READ_REQUESTED and I2C_SLAVE_READ_PROCESSED. It leaves it
> untouched, so a master that reads from the slave address gets whatever
> the bus driver had there. On aspeed the first byte is the address byte
> that was just received and every following byte is an uninitialised
> stack variable.
> 
> Return 0xff, as ipmi_ipmb does since commit 9f235ccecd03 ("ipmi: ipmb:
> initialise event handler read bytes").

This looks correct to me.  Queued for next release.

Adding Asmaa for comment.

-corey

> 
> Fixes: 51bd6f291583 ("Add support for IPMB driver")
> Cc: stable@vger.kernel.org
> Signed-off-by: Eric Yun Lin Chiang <ericyunlinchiang@gmail.com>
> ---
> Notes (not for the changelog):
> 
> - Testing: a KUnit case on UML with KASAN, kept out of this patch and
>   available on request, calls ipmb_slave_cb() for both read events with
>   *val preset to 0xa5: before, it stays 0xa5; after, 0xff. A write of
>   two bytes is stored the same way before and after. Built for ARM
>   (aspeed_g5_defconfig plus IPMB_DEVICE_INTERFACE) with W=1, no new
>   warnings. Not run on hardware.
> - Tool use: found, and this change and its test drafted, with the help
>   of an AI coding assistant (Claude).
> 
>  drivers/char/ipmi/ipmb_dev_int.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/char/ipmi/ipmb_dev_int.c b/drivers/char/ipmi/ipmb_dev_int.c
> index 5edc2be85..4ccc75321 100644
> --- a/drivers/char/ipmi/ipmb_dev_int.c
> +++ b/drivers/char/ipmi/ipmb_dev_int.c
> @@ -292,6 +292,12 @@ static int ipmb_slave_cb(struct i2c_client *client,
>  			ipmb_handle_request(ipmb_dev);
>  		break;
>  
> +	case I2C_SLAVE_READ_REQUESTED:
> +	case I2C_SLAVE_READ_PROCESSED:
> +		/* IPMB does not use reads, but the bus driver sends *val */
> +		*val = 0xff;
> +		break;
> +
>  	default:
>  		break;
>  	}
> -- 
> 2.53.0
> 

      reply	other threads:[~2026-12-06 13:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-03  6:34 [PATCH] ipmi: ipmb_dev_int: initialise event handler read bytes Eric Yun Lin Chiang
2026-12-06 13:54 ` Corey Minyard [this message]

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=axVpCcNOikGMRABD@mail.minyard.net \
    --to=corey@minyard.net \
    --cc=Asmaa@mellanox.com \
    --cc=ericyunlinchiang@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=openipmi-developer@lists.sourceforge.net \
    --cc=stable@vger.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