All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Jarkko Sakkinen <jarkko@kernel.org>
Cc: oe-kbuild-all@lists.linux.dev
Subject: [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
Date: Thu, 12 Dec 2024 16:24:57 +0800	[thread overview]
Message-ID: <202412121623.9I5dRbb9-lkp@intel.com> (raw)

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

                 reply	other threads:[~2024-12-12  8:25 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202412121623.9I5dRbb9-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=jarkko@kernel.org \
    --cc=oe-kbuild-all@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.