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

[media] v4l: omap4iss: use snprintf() to make smatch happy

Smatch complains here because name is a 32 character buffer and we
adding the "OMAP4 ISS " prefix as well for a total of 42 characters.
The sd->name buffer can only hold 32 characters. I've changed it to use
snprintf() to silence the overflow warning.

Also I have removed the call to strlcpy() which is a no-op.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>

authored by

Dan Carpenter and committed by
Mauro Carvalho Chehab
eaf95eee 31a2d43d

+1 -2
+1 -2
drivers/staging/media/omap4iss/iss_csi2.c
··· 1247 1247 v4l2_subdev_init(sd, &csi2_ops); 1248 1248 sd->internal_ops = &csi2_internal_ops; 1249 1249 sprintf(name, "CSI2%s", subname); 1250 - strlcpy(sd->name, "", sizeof(sd->name)); 1251 - sprintf(sd->name, "OMAP4 ISS %s", name); 1250 + snprintf(sd->name, sizeof(sd->name), "OMAP4 ISS %s", name); 1252 1251 1253 1252 sd->grp_id = 1 << 16; /* group ID for iss subdevs */ 1254 1253 v4l2_set_subdevdata(sd, csi2);