media: staging: media: zoran: calculate the right buffer number for zoran_reap_stat_com
authorCorentin Labbe <clabbe@baylibre.com>
Tue, 14 Dec 2021 16:16:32 +0000 (17:16 +0100)
committerMauro Carvalho Chehab <mchehab@kernel.org>
Sun, 23 Jan 2022 20:18:40 +0000 (21:18 +0100)
commite3b86f4e558cea9eed71d894df2f19b10d60a207
tree322e379372bc82f2bc493b9e9c07713e2e1e8fa8
parent4e3edddb9507a28446624144da6be5d1323e6f15
media: staging: media: zoran: calculate the right buffer number for zoran_reap_stat_com

On the case tmp_dcim=1, the index of buffer is miscalculated.
This generate a NULL pointer dereference later.

So let's fix the calcul and add a check to prevent this to reappear.

Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
drivers/staging/media/zoran/zoran_device.c