[PATCH v2 0/3] media: Fix gcc warnings

From: Ricardo Ribalda
Date: Mon Mar 25 2024 - 12:22:22 EST


drivers/staging/media/tegra-video/tegra20.c: In function ‘tegra20_vip_start_streaming’:
drivers/staging/media/tegra-video/tegra20.c:624:72: warning: ‘yuv_input_format’ may be used uninitialized [-Wmaybe-uninitialized]
624 | VI_INPUT_VIP_INPUT_ENABLE | main_input_format | yuv_input_format);
drivers/staging/media/tegra-video/tegra20.c:617:22: note: ‘yuv_input_format’ was declared here
617 | unsigned int yuv_input_format;
| ^~~~~~~~~~~~~~~~
drivers/media/radio/radio-shark2.c: In function ‘usb_shark_probe’:
drivers/media/radio/radio-shark2.c:191:17: warning: ‘%s’ directive output may be truncated writing up to 35 bytes into a region of size 32 [-Wformat-truncation=]
191 | .name = "%s:blue:",
| ^
In function ‘shark_register_leds’,
inlined from ‘usb_shark_probe’ at drivers/media/radio/radio-shark2.c:306:11:
drivers/media/radio/radio-shark2.c:212:17: note: ‘snprintf’ output between 7 and 42 bytes into a destination of size 32
212 | snprintf(shark->led_names[i], sizeof(shark->led_names[0]),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
213 | shark->leds[i].name, shark->v4l2_dev.name);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/media/radio/radio-shark2.c: In function ‘usb_shark_probe’:
drivers/media/radio/radio-shark2.c:197:17: warning: ‘%s’ directive output may be truncated writing up to 35 bytes into a region of size 32 [-Wformat-truncation=]
197 | .name = "%s:red:",
| ^
In function ‘shark_register_leds’,
inlined from ‘usb_shark_probe’ at drivers/media/radio/radio-shark2.c:306:11:
drivers/media/radio/radio-shark2.c:212:17: note: ‘snprintf’ output between 6 and 41 bytes into a destination of size 32
212 | snprintf(shark->led_names[i], sizeof(shark->led_names[0]),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
213 | shark->leds[i].name, shark->v4l2_dev.name);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
AR drivers/staging/media/tegra-video/built-in.a
AR drivers/staging/media/built-in.a
In file included from ./include/asm-generic/preempt.h:5,
from ./arch/arm/include/generated/asm/preempt.h:1,
from ./include/linux/preempt.h:79,
from ./include/linux/spinlock.h:56,
from ./include/linux/mmzone.h:8,
from ./include/linux/gfp.h:7,
from ./include/linux/umh.h:4,
from ./include/linux/kmod.h:9,
from ./include/linux/module.h:17,
from drivers/media/dvb-core/dvbdev.c:15:
In function ‘check_object_size’,
inlined from ‘check_copy_size’ at ./include/linux/thread_info.h:251:2,
inlined from ‘copy_from_user’ at ./include/linux/uaccess.h:182:6,
inlined from ‘dvb_usercopy’ at drivers/media/dvb-core/dvbdev.c:987:7:
./include/linux/thread_info.h:215:17: warning: ‘sbuf’ may be used uninitialized [-Wmaybe-uninitialized]
215 | __check_object_size(ptr, n, to_user);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./include/linux/thread_info.h: In function ‘dvb_usercopy’:
./include/linux/thread_info.h:208:13: note: by argument 1 of type ‘const void *’ to ‘__check_object_size’ declared here
208 | extern void __check_object_size(const void *ptr, unsigned long n,
| ^~~~~~~~~~~~~~~~~~~
drivers/media/dvb-core/dvbdev.c:959:17: note: ‘sbuf’ declared here
959 | char sbuf[128];
| ^~~~
AR drivers/media/radio/built-in.a

Signed-off-by: Ricardo Ribalda <ribalda@xxxxxxxxxxxx>
---
Changes in v2: Thanks Thierry
- Make tegra20_vi_get_output_formats() and tegra20_vi_get_inut_formats,
consistent.
- Link to v1: https://lore.kernel.org/r/20240323-gcc-arm-warnings-v1-0-0b45cc52f39e@xxxxxxxxxxxx

---
Ricardo Ribalda (3):
staging: media: tegra-video: Fix -Wmaybe-unitialized warn in gcc
media: radio-shark2: Avoid led_names truncations
media: dvbdev: Initialize sbuf

drivers/media/dvb-core/dvbdev.c | 2 +-
drivers/media/radio/radio-shark2.c | 2 +-
drivers/staging/media/tegra-video/tegra20.c | 1 +
3 files changed, 3 insertions(+), 2 deletions(-)
---
base-commit: b14257abe7057def6127f6fb2f14f9adc8acabdb
change-id: 20240323-gcc-arm-warnings-e4c142cb5ac0

Best regards,
--
Ricardo Ribalda <ribalda@xxxxxxxxxxxx>