]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
media: dvbdev: Initialize sbuf
authorRicardo Ribalda <ribalda@chromium.org>
Mon, 25 Mar 2024 14:50:25 +0000 (14:50 +0000)
committerHans Verkuil <hverkuil-cisco@xs4all.nl>
Mon, 8 Apr 2024 11:48:19 +0000 (13:48 +0200)
Because the size passed to copy_from_user() cannot be known beforehand,
it needs to be checked during runtime with check_object_size. That makes
gcc believe that the content of sbuf can be used before init.

Fix:
./include/linux/thread_info.h:215:17: warning: ‘sbuf’ may be used uninitialized [-Wmaybe-uninitialized]

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
drivers/media/dvb-core/dvbdev.c

index 733d0bc4b4cc3accbb8123947f7ea1edd69016db..b43695bc51e754c70aea25757fbd86b4b4ac2f4f 100644 (file)
@@ -956,7 +956,7 @@ int dvb_usercopy(struct file *file,
                 int (*func)(struct file *file,
                             unsigned int cmd, void *arg))
 {
-       char    sbuf[128];
+       char    sbuf[128] = {};
        void    *mbuf = NULL;
        void    *parg = NULL;
        int     err  = -EINVAL;