WSL2-Linux-Kernel/drivers/media
Linus Torvalds efbcbb12ee media: m5mols: fix off-by-one loop termination error
The __find_restype() function loops over the m5mols_default_ffmt[]
array, and the termination condition ends up being wrong: instead of
stopping when the iterator becomes the size of the array it traverses,
it stops after it has already overshot the array.

Now, in practice this doesn't likely matter, because the code will
always find the entry it looks for, and will thus return early and never
hit that last extra iteration.

But it turns out that clang will unroll the loop fully, because it has
only two iterations (well, three due to the off-by-one bug), and then
clang will end up just giving up in the middle of the loop unrolling
when it notices that the code walks past the end of the array.

And that made 'objtool' very unhappy indeed, because the generated code
just falls off the edge of the universe, and ends up falling through to
the next function, causing this warning:

   drivers/media/i2c/m5mols/m5mols.o: warning: objtool: m5mols_set_fmt() falls through to next function m5mols_get_frame_desc()

Fix the loop ending condition.

Reported-by: Jens Axboe <axboe@kernel.dk>
Analyzed-by: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
Analyzed-by: Nick Desaulniers <ndesaulniers@google.com>
Link: https://lore.kernel.org/linux-block/CAHk-=wgTSdKYbmB1JYM5vmHMcD9J9UZr0mn7BOYM_LudrP+Xvw@mail.gmail.com/
Fixes: bc125106f8 ("[media] Add support for M-5MOLS 8 Mega Pixel camera ISP")
Cc: HeungJun, Kim <riverful.kim@samsung.com>
Cc: Sylwester Nawrocki <s.nawrocki@samsung.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
Cc: Mauro Carvalho Chehab <mchehab@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2023-03-18 11:07:15 -07:00
..
cec
common media updates for v6.3-rc1 2023-02-26 11:47:26 -08:00
dvb-core
dvb-frontends media: dvb-frontends: mb86a16.c: always use the same error path 2023-02-08 08:40:13 +01:00
firewire
i2c media: m5mols: fix off-by-one loop termination error 2023-03-18 11:07:15 -07:00
mc
mmc
pci media updates for v6.3-rc1 2023-02-26 11:47:26 -08:00
platform ARM: SoC drivers for 6.3 2023-02-27 10:04:49 -08:00
radio media: radio/wl128x: remove unnecessary (void*) conversions 2023-02-08 07:26:02 +01:00
rc media updates for v6.3-rc1 2023-02-26 11:47:26 -08:00
spi
test-drivers media: visl: make visl_qops static 2023-02-08 08:29:53 +01:00
tuners
usb media updates for v6.3-rc1 2023-02-26 11:47:26 -08:00
v4l2-core media updates for v6.3-rc1 2023-02-26 11:47:26 -08:00
Kconfig
Makefile