Re: [PATCH v1 2/2] spi: Avoid potential UB when counting unused native CSs

2021-04-20 Thread Mark Brown
On Tue, Apr 20, 2021 at 06:07:06PM +0300, Andy Shevchenko wrote: > On Tue, Apr 20, 2021 at 03:56:16PM +0100, Mark Brown wrote: > > On Tue, Apr 20, 2021 at 05:10:04PM +0300, Andy Shevchenko wrote: > > > ffz(), that has been used to count unused native CSs, might produce UB > > Bit of an IA

Re: [PATCH v1 2/2] spi: Avoid potential UB when counting unused native CSs

2021-04-20 Thread Andy Shevchenko
On Tue, Apr 20, 2021 at 03:56:16PM +0100, Mark Brown wrote: > On Tue, Apr 20, 2021 at 05:10:04PM +0300, Andy Shevchenko wrote: > > ffz(), that has been used to count unused native CSs, might produce UB > > Bit of an IA there... UB -- undefined behaviour. I'll decode it. Should I decode CS as

Re: [PATCH v1 2/2] spi: Avoid potential UB when counting unused native CSs

2021-04-20 Thread Mark Brown
On Tue, Apr 20, 2021 at 05:10:04PM +0300, Andy Shevchenko wrote: > ffz(), that has been used to count unused native CSs, might produce UB Bit of an IA there... signature.asc Description: PGP signature

[PATCH v1 2/2] spi: Avoid potential UB when counting unused native CSs

2021-04-20 Thread Andy Shevchenko
ffz(), that has been used to count unused native CSs, might produce UB when called against ~0U. To fix that, open code it with ffs(~value) - 1. Fixes: 7d93aecdb58d ("spi: Add generic support for unused native cs with cs-gpios") Signed-off-by: Andy Shevchenko --- drivers/spi/spi.c | 2 +- 1