android_kernel_motorola_sm6375/drivers/media
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Linus Torvalds 75f6faae2d media: m5mols: fix off-by-one loop termination error
[ Upstream commit efbcbb12ee99f750c9f25c873b55ad774871de2a ]

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 <[email protected]>
Analyzed-by: Miguel Ojeda <[email protected]>
Analyzed-by: Nick Desaulniers <[email protected]>
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 <[email protected]>
Cc: Sylwester Nawrocki <[email protected]>
Cc: Kyungmin Park <[email protected]>
Cc: Mauro Carvalho Chehab <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
2023-03-22 13:28:07 +01:00
..
cec media: cec-adap.c: fix is_configuring state 2022-06-14 18:11:28 +02:00
common media: saa7146: hexium_gemini: Fix a NULL pointer dereference in hexium_attach() 2022-01-27 09:19:43 +01:00
dvb-core media: dvb-core: Fix UAF due to refcount races at releasing 2023-01-18 11:41:48 +01:00
dvb-frontends media: stv0288: use explicitly signed char 2023-01-18 11:41:45 +01:00
firewire
i2c media: m5mols: fix off-by-one loop termination error 2023-03-22 13:28:07 +01:00
mc
mmc
pci media: ipu3-cio2: Fix PM runtime usage_count in driver unbind 2023-03-11 16:44:05 +01:00
platform media: platform: ti: Add missing check for devm_regulator_get 2023-03-11 16:43:52 +01:00
radio media: si470x: Fix use-after-free in si470x_int_in_callback() 2023-01-18 11:41:38 +01:00
rc media: rc: Fix use-after-free bugs caused by ene_tx_irqsim() 2023-03-11 16:43:53 +01:00
spi
tuners
usb media: uvcvideo: Fix race condition with usb_kill_urb 2023-03-11 16:44:16 +01:00
v4l2-core media: videobuf-dma-contig: use dma_mmap_coherent 2023-01-18 11:41:04 +01:00
Kconfig
Makefile