Re: [PATCH] IOMUX: Fix access past end of console_devices

2022-03-31 Thread Andy Shevchenko
On Wed, Mar 30, 2022 at 01:25:59PM -0400, Sean Anderson wrote: > On 3/30/22 1:13 PM, Andy Shevchenko wrote: > > On Wed, Mar 30, 2022 at 7:49 PM Sean Anderson wrote: > > > > Also I don't like to have workarounds for the broken tools. > > But if you still want to have something, what about rather t

Re: [PATCH] IOMUX: Fix access past end of console_devices

2022-03-30 Thread Sean Anderson
On 3/30/22 1:13 PM, Andy Shevchenko wrote: On Wed, Mar 30, 2022 at 7:49 PM Sean Anderson wrote: Also I don't like to have workarounds for the broken tools. But if you still want to have something, what about rather this #define for_each_console_dev(i, file, dev) \ - for (i

Re: [PATCH] IOMUX: Fix access past end of console_devices

2022-03-30 Thread Andy Shevchenko
On Wed, Mar 30, 2022 at 7:49 PM Sean Anderson wrote: Also I don't like to have workarounds for the broken tools. But if you still want to have something, what about rather this > #define for_each_console_dev(i, file, dev) \ > - for (i = 0, dev = console_devices[file][i]; \

Re: [PATCH] IOMUX: Fix access past end of console_devices

2022-03-30 Thread Sean Anderson
On 3/30/22 1:07 PM, Andy Shevchenko wrote: On Wed, Mar 30, 2022 at 8:01 PM Andy Shevchenko wrote: On Wed, Mar 30, 2022 at 7:49 PM Sean Anderson wrote: ... #define for_each_console_dev(i, file, dev) \ - for (i = 0, dev = console_devices[file][i]; \ When we enter th

Re: [PATCH] IOMUX: Fix access past end of console_devices

2022-03-30 Thread Andy Shevchenko
On Wed, Mar 30, 2022 at 8:05 PM Sean Anderson wrote: > On 3/30/22 1:01 PM, Andy Shevchenko wrote: > > On Wed, Mar 30, 2022 at 7:49 PM Sean Anderson wrote: ... > >> #define for_each_console_dev(i, file, dev) \ > >> - for (i = 0, dev = console_devices[file][i]; \ > > > > W

Re: [PATCH] IOMUX: Fix access past end of console_devices

2022-03-30 Thread Andy Shevchenko
On Wed, Mar 30, 2022 at 8:01 PM Andy Shevchenko wrote: > On Wed, Mar 30, 2022 at 7:49 PM Sean Anderson wrote: ... > > #define for_each_console_dev(i, file, dev) \ > > - for (i = 0, dev = console_devices[file][i]; \ > > When we enter the loop, the dev is assigned and perha

Re: [PATCH] IOMUX: Fix access past end of console_devices

2022-03-30 Thread Sean Anderson
On 3/30/22 1:01 PM, Andy Shevchenko wrote: On Wed, Mar 30, 2022 at 7:49 PM Sean Anderson wrote: We should only access console_devices[file][i] once we have checked that i < cd_count[file]. Otherwise, we will access uninitialized memory at the end of the loop. console_devices[file][i] should no

Re: [PATCH] IOMUX: Fix access past end of console_devices

2022-03-30 Thread Andy Shevchenko
On Wed, Mar 30, 2022 at 7:49 PM Sean Anderson wrote: > > We should only access console_devices[file][i] once we have checked that > i < cd_count[file]. Otherwise, we will access uninitialized memory at the end > of > the loop. console_devices[file][i] should not be NULL, but putting the > assignm

[PATCH] IOMUX: Fix access past end of console_devices

2022-03-30 Thread Sean Anderson
We should only access console_devices[file][i] once we have checked that i < cd_count[file]. Otherwise, we will access uninitialized memory at the end of the loop. console_devices[file][i] should not be NULL, but putting the assignment in the loop condition allows us to ensure that i is checked bef