* There is a potential buffer overflow issue in bmi323
@ 2024-09-12 9:50 Qianqiang Liu
0 siblings, 0 replies; 2+ messages in thread
From: Qianqiang Liu @ 2024-09-12 9:50 UTC (permalink / raw)
To: benato.denis96; +Cc: jagathjog1996, jic23, linux-iio, linux-kernel
Hi,
I reviewed the following code in drivers/iio/imu/bmi323/bmi323_core.c:
2245 for (unsigned int i = 0; i < ARRAY_SIZE(bmi323_ext_reg_savestate); i++) { <-
2246 ret = bmi323_write_ext_reg(data, bmi323_reg_savestate[i], <-
2247 savestate->reg_settings[i]);
2248 if (ret) {
2249 dev_err(data->dev,
2250 "Error writing bmi323 external reg 0x%x: %d\n",
2251 bmi323_reg_savestate[i], ret);
2252 return ret;
2253 }
2254 }
The array size of the "bmi323_ext_reg_savestate" is twelve, and the
array size of "bmi323_reg_savestate" is nine.
Is it possible that "bmi323_reg_savestate" may have buffer overflow
issue?
--
Best,
Qianqiang Liu
^ permalink raw reply [flat|nested] 2+ messages in thread[parent not found: <66e2b969.170a0220.29a2d3.4b31SMTPIN_ADDED_BROKEN@mx.google.com>]
* Re: There is a potential buffer overflow issue in bmi323
[not found] <66e2b969.170a0220.29a2d3.4b31SMTPIN_ADDED_BROKEN@mx.google.com>
@ 2024-09-14 12:07 ` Denis Benato
0 siblings, 0 replies; 2+ messages in thread
From: Denis Benato @ 2024-09-14 12:07 UTC (permalink / raw)
To: Qianqiang Liu; +Cc: jagathjog1996, jic23, linux-iio, linux-kernel
On 12/09/24 11:50, Qianqiang Liu wrote:
> Hi,
>
> I reviewed the following code in drivers/iio/imu/bmi323/bmi323_core.c:
>
> 2245 for (unsigned int i = 0; i < ARRAY_SIZE(bmi323_ext_reg_savestate); i++) { <-
> 2246 ret = bmi323_write_ext_reg(data, bmi323_reg_savestate[i], <-
> 2247 savestate->reg_settings[i]);
> 2248 if (ret) {
> 2249 dev_err(data->dev,
> 2250 "Error writing bmi323 external reg 0x%x: %d\n",
> 2251 bmi323_reg_savestate[i], ret);
> 2252 return ret;
> 2253 }
> 2254 }
>
> The array size of the "bmi323_ext_reg_savestate" is twelve, and the
> array size of "bmi323_reg_savestate" is nine.
>
> Is it possible that "bmi323_reg_savestate" may have buffer overflow
> issue?
>
Hi,
You are very right and that is copy/paste mistake that was not flagged as a warning by gcc.
Thanks for letting me know!
There is currently a fix already sent for review here:
https://lore.kernel.org/all/20240909-iio-bmi323-fix-array-ref-v1-1-51c220f22229@kernel.org
Best regards,
Denis Benato
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-09-14 12:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-12 9:50 There is a potential buffer overflow issue in bmi323 Qianqiang Liu
[not found] <66e2b969.170a0220.29a2d3.4b31SMTPIN_ADDED_BROKEN@mx.google.com>
2024-09-14 12:07 ` Denis Benato
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox