Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[media] V4L2: soc-camera: fix uninitialised use compiler warning

In scan_async_group() if the size parameter is negative, the sasd pointer
will be used uninitialised:
drivers/media/platform/soc_camera/soc_camera.c: In function "soc_camera_host_register":
drivers/media/platform/soc_camera/soc_camera.c:1514:55: warning: "sasd" may
be used uninitialized in this function [-Wmaybe-uninitialized]
sasd->asd.match.i2c.adapter_id, sasd->asd.match.i2c.address);
^
drivers/media/platform/soc_camera/soc_camera.c:1464:34: note: "sasd" was
declared here
struct soc_camera_async_subdev *sasd;
Fix this by making "size" and the array, from which it is assigned unsigned.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>

authored by

Guennadi Liakhovetski and committed by
Mauro Carvalho Chehab
f687f326 fe05e141

+3 -3
+1 -1
drivers/media/platform/soc_camera/soc_camera.c
··· 1459 1459 } 1460 1460 1461 1461 static int scan_async_group(struct soc_camera_host *ici, 1462 - struct v4l2_async_subdev **asd, int size) 1462 + struct v4l2_async_subdev **asd, unsigned int size) 1463 1463 { 1464 1464 struct soc_camera_async_subdev *sasd; 1465 1465 struct soc_camera_async_client *sasc;
+1 -1
include/media/sh_mobile_ceu.h
··· 23 23 int max_height; 24 24 struct sh_mobile_ceu_companion *csi2; 25 25 struct v4l2_async_subdev **asd; /* Flat array, arranged in groups */ 26 - int *asd_sizes; /* 0-terminated array pf asd group sizes */ 26 + unsigned int *asd_sizes; /* 0-terminated array pf asd group sizes */ 27 27 }; 28 28 29 29 #endif /* __ASM_SH_MOBILE_CEU_H__ */
+1 -1
include/media/soc_camera.h
··· 87 87 const char *drv_name; 88 88 struct soc_camera_host_ops *ops; 89 89 struct v4l2_async_subdev **asd; /* Flat array, arranged in groups */ 90 - int *asd_sizes; /* 0-terminated array of asd group sizes */ 90 + unsigned int *asd_sizes; /* 0-terminated array of asd group sizes */ 91 91 }; 92 92 93 93 struct soc_camera_host_ops {