ipmi: ipmb: initialise event handler read bytes
PATCH 1/1 ipmi: ipmb: initialise event handler read bytes
IPMB doesn't use i2c reads, but the handler needs to set a value. Otherwise an i2c read will return an uninitialised value from the bus driver.
--- drivers/char/ipmi/ipmi_ipmb.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/char/ipmi/ipmi_ipmb.c +5 -0
@@ -202,11 +202,16 @@ static int ipmi_ipmb_slave_cb(struct i2c_client *client,break ;case I2C_SLAVE_READ_REQUESTED : + *val =0xff ; +ipmi_ipmb_check_msg_done (iidev); +break ; +case I2C_SLAVE_STOP :ipmi_ipmb_check_msg_done (iidev);break ;case I2C_SLAVE_READ_PROCESSED : + *val =0xff ;break ; }
---
base-commit: b71e635feefc852405b14620a7fc58c4c80c0f73
change-id: 20260113-ipmb-read-init-5b97dfbcd3b9
Best regards,
Signature · 1 line
Matt Johnston <[email protected]>
Quoted 3 lines
IPMB doesn't use i2c reads, but the handler needs to set a value. Otherwise an i2c read will return an uninitialised value from the bus driver.
See also once more:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.19-rc5#n94
Regards,
Markus
Corey Minyard
maintainerQuoted 3 lines · Matt Johnston
IPMB doesn't use i2c reads, but the handler needs to set a value. Otherwise an i2c read will return an uninitialised value from the bus driver.
This is fine, I suppose. It's probably better to do this.
Are you actually using this code? How was it found?
-corey
Quoted 37 lines
Fixes 63c4eb347164 ("ipmi:ipmb: Add initial support for IPMI over IPMB")Signed-off-by Matt Johnston <[email protected]>--- drivers/char/ipmi/ipmi_ipmb.c | 5 +++++ 1 file changed, 5 insertions(+)drivers/char/ipmi/ipmi_ipmb.c +5
-1@@ -202,11 +202,16 @@ static int ipmi_ipmb_slave_cb(struct i2c_client *client,break ;case I2C_SLAVE_READ_REQUESTED : + *val =0xff ; +ipmi_ipmb_check_msg_done (iidev); +break ; +case I2C_SLAVE_STOP :ipmi_ipmb_check_msg_done (iidev);break ;case I2C_SLAVE_READ_PROCESSED : + *val =0xff ;break ; } ---base-commit:
b71e635feefc852405b14620a7fc58c4c80c0f73
change-id: 20260113-ipmb-read-init-5b97dfbcd3b9Best regards,
Signature · 1 line
Matt Johnston <[email protected]>
Hi Corey,
Quoted 8 lines · Corey Minyard
Quoted 3 lines · Matt Johnston
IPMB doesn't use i2c reads, but the handler needs to set a value. Otherwise an i2c read will return an uninitialised value from the bus driver.
This is fine, I suppose. It's probably better to do this.
Are you actually using this code? How was it found?
I'm not using IPMB, so haven't tested the patch on hardware. We received a patch for mctp-i2c read handling, that made me notice the uninitialised value problem there. I had a look over other i2c_slave_register() kernel users to see if the problem was common (mctp-i2c used ipmi-ipmb as a bit of a reference during development too).
https://lore.kernel.org/netdev/20260108101829.1140448-1-
[email protected]/
https://lore.kernel.org/netdev/20260113-mctp-read-fix-v1-1-
[email protected]/
Cheers,
Matt
Corey Minyard
maintainerQuoted 10 lines · Matt Johnston
Hi Corey,
Quoted 7 lines · Corey Minyard
Quoted 3 lines · Matt Johnston
IPMB doesn't use i2c reads, but the handler needs to set a value. Otherwise an i2c read will return an uninitialised value from the bus driver.
This is fine, I suppose. It's probably better to do this.
Quoted 7 lines
Quoted 1 line
Are you actually using this code? How was it found?
I'm not using IPMB, so haven't tested the patch on hardware. We received a patch for mctp-i2c read handling, that made me notice the uninitialised value problem there. I had a look over other i2c_slave_register() kernel users to see if the problem was common (mctp-i2c used ipmi-ipmb as a bit of a reference during development too).
Ok, thanks for the history on this. It's in my tree.
-corey