All of lore.kernel.org
 help / color / mirror / Atom feed
* [jarkko-tpmdd:v4l2-loopback 2/2] drivers/media/v4l2-core/v4l2-loopback.c:1276:49: warning: '%s' directive output may be truncated writing up to 63 bytes into a region of size 32
@ 2024-12-12  8:24 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2024-12-12  8:24 UTC (permalink / raw)
  To: Jarkko Sakkinen; +Cc: oe-kbuild-all

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/jarkko/linux-tpmdd.git v4l2-loopback
head:   a3f82e653c46a6e972edb5f623ab83190db10758
commit: a3f82e653c46a6e972edb5f623ab83190db10758 [2/2] media: v4l2-loopback
config: loongarch-allyesconfig (https://download.01.org/0day-ci/archive/20241212/202412121623.9I5dRbb9-lkp@intel.com/config)
compiler: loongarch64-linux-gcc (GCC) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241212/202412121623.9I5dRbb9-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202412121623.9I5dRbb9-lkp@intel.com/

All warnings (new ones prefixed by >>):

   drivers/media/v4l2-core/v4l2-loopback.c: In function 'inner_try_setfmt':
   drivers/media/v4l2-core/v4l2-loopback.c:748:14: warning: variable 'buf' set but not used [-Wunused-but-set-variable]
     748 |         char buf[5];
         |              ^~~
   drivers/media/v4l2-core/v4l2-loopback.c: In function 'vidioc_s_fmt_out':
   drivers/media/v4l2-core/v4l2-loopback.c:1576:14: warning: variable 'buf' set but not used [-Wunused-but-set-variable]
    1576 |         char buf[5];
         |              ^~~
   drivers/media/v4l2-core/v4l2-loopback.c: In function 'vidioc_querycap':
>> drivers/media/v4l2-core/v4l2-loopback.c:1276:49: warning: '%s' directive output may be truncated writing up to 63 bytes into a region of size 32 [-Wformat-truncation=]
    1276 |         snprintf(cap->card, sizeof(cap->card), "%s", dev->vdev->name);
         |                                                 ^~
   drivers/media/v4l2-core/v4l2-loopback.c:1276:9: note: 'snprintf' output between 1 and 64 bytes into a destination of size 32
    1276 |         snprintf(cap->card, sizeof(cap->card), "%s", dev->vdev->name);
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


vim +1276 drivers/media/v4l2-core/v4l2-loopback.c

  1261	
  1262	/* V4L2 ioctl caps and params calls */
  1263	/* returns device capabilities
  1264	 * called on VIDIOC_QUERYCAP
  1265	 */
  1266	static int vidioc_querycap(struct file *file, void *priv,
  1267				   struct v4l2_capability *cap)
  1268	{
  1269		struct v4l2_loopback_device *dev = v4l2l_getdevice(file);
  1270		int device_nr =
  1271			((struct v4l2l_private *)video_get_drvdata(dev->vdev))
  1272				->device_nr;
  1273		__u32 capabilities = V4L2_CAP_STREAMING | V4L2_CAP_READWRITE;
  1274	
  1275		strscpy(cap->driver, "v4l2 loopback", sizeof(cap->driver));
> 1276		snprintf(cap->card, sizeof(cap->card), "%s", dev->vdev->name);
  1277		snprintf(cap->bus_info, sizeof(cap->bus_info),
  1278			 "platform:v4l2loopback-%03d", device_nr);
  1279	
  1280		if (dev->announce_all_caps) {
  1281			capabilities |= V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_VIDEO_OUTPUT;
  1282		} else {
  1283			if (dev->ready_for_capture) {
  1284				capabilities |= V4L2_CAP_VIDEO_CAPTURE;
  1285			}
  1286			if (dev->ready_for_output) {
  1287				capabilities |= V4L2_CAP_VIDEO_OUTPUT;
  1288			}
  1289		}
  1290	
  1291		dev->vdev->device_caps = cap->device_caps = cap->capabilities = capabilities;
  1292		cap->capabilities |= V4L2_CAP_DEVICE_CAPS;
  1293		memset(cap->reserved, 0, sizeof(cap->reserved));
  1294		return 0;
  1295	}
  1296	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-12-12  8:25 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-12  8:24 [jarkko-tpmdd:v4l2-loopback 2/2] drivers/media/v4l2-core/v4l2-loopback.c:1276:49: warning: '%s' directive output may be truncated writing up to 63 bytes into a region of size 32 kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.