linux-stable/drivers/staging
Hans de Goede a3b36a8ce3 media: atomisp: revert "don't pass a pointer to a local variable"
The gcc is warning about returning a pointer to a local variable
is a false positive.

The type of handle is "struct ia_css_rmgr_vbuf_handle **" and
"h.vptr" is left to NULL, so the "if ((*handle)->vptr == 0x0)"
check always succeeds when the "*handle = &h;" statement which
gcc warns about executes. Leading to this statement being executed:

	rmgr_pop_handle(pool, handle);

If that succeeds,  then *handle has been set to point to one of
the pre-allocated array of handles, so it no longer points to h.

If that fails the following statement will be executed:

	/* Note that handle will change to an internally maintained one */
	ia_css_rmgr_refcount_retain_vbuf(handle);

Which allocated a new handle from the array of pre-allocated handles
and then makes *handle point to this. So the address of h is actually
never returned.

The fix for the false-postive compiler warning actually breaks the code,
the new:

	**handle = h;

is part of a "if (pool->copy_on_write) { ... }" which means that the
handle where *handle points to should be treated read-only, IOW
**handle must never be set, instead *handle must be set to point to
a new handle (with a copy of the contents of the old handle).

The old code correctly did this and the new fixed code gets this wrong.

Note there is another patch in this series, which fixes the warning
in another way.

Link: https://lore.kernel.org/linux-media/20220612160556.108264-2-hdegoede@redhat.com
Fixes: fa1451374e ("media: atomisp: don't pass a pointer to a local variable")
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-07-08 17:44:31 +01:00
..
axis-fifo
board
clocking-wizard
emxx_udc
fbtft fbdev: Use pageref offset for deferred-I/O writeback 2022-05-03 16:04:22 +02:00
fieldbus staging: fieldbus: Fix the error handling path in anybuss_host_common_probe() 2022-04-22 16:48:31 +02:00
fwserial
gdm724x
greybus Staging driver updates for 5.19-rc1 2022-06-03 10:44:43 -07:00
iio staging: iio: ad2s1210: remove redundant assignment to variable negative 2022-04-28 19:22:56 +01:00
ks7010 staging: ks7010: remove null check after call container_of() 2022-05-19 17:42:41 +02:00
media media: atomisp: revert "don't pass a pointer to a local variable" 2022-07-08 17:44:31 +01:00
most staging/most, dim2: convert dim2_tasklet to threaded irq 2022-04-12 15:53:50 +02:00
nvec
octeon
octeon-usb
olpc_dcon staging: olpc_dcon: mark driver as broken 2022-06-10 09:09:47 +02:00
pi433
qlge staging: qlge: add blank line after function declaration 2022-04-20 18:40:04 +02:00
r8188eu staging: r8188eu: Fix warning of array overflow in ioctl_linux.c 2022-06-06 08:10:14 +02:00
rtl8192e staging: rtl8192e: remove null check after call container_of() 2022-05-19 17:42:43 +02:00
rtl8192u staging: rtl8192u: remove null check after call container_of() 2022-05-19 17:42:53 +02:00
rtl8712 staging: rtl8712: fix uninit-value in r871xu_drv_init() 2022-05-19 17:44:25 +02:00
rtl8723bs staging: rtl8723bs: Allocate full pwep structure 2022-06-10 09:10:16 +02:00
rts5208
sm750fb
vc04_services staging: vc04_services: remove unused macro 2022-05-19 17:42:56 +02:00
vme_user staging: vme: Move 'vme/devices/' to 'vme_user/' 2022-04-22 16:47:29 +02:00
vt6655 staging: vt6655: Replace VNSvOutPortB with iowrite8 2022-05-19 17:41:10 +02:00
vt6656
wlan-ng staging/wlan-ng, prism2usb: replace completion_bh tasklet with work 2022-04-12 15:53:50 +02:00
Kconfig staging: vme: Move 'vme/devices/' to 'vme_user/' 2022-04-22 16:47:29 +02:00
Makefile staging: vme: Move 'vme/devices/' to 'vme_user/' 2022-04-22 16:47:29 +02:00