]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
media: zoran: fix compiler warning
authorHans Verkuil <hans.verkuil@cisco.com>
Mon, 14 May 2018 12:51:44 +0000 (08:51 -0400)
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Fri, 25 May 2018 19:30:30 +0000 (15:30 -0400)
In file included from media-git/include/linux/bitmap.h:9,
                 from media-git/include/linux/cpumask.h:12,
                 from media-git/arch/x86/include/asm/cpumask.h:5,
                 from media-git/arch/x86/include/asm/msr.h:11,
                 from media-git/arch/x86/include/asm/processor.h:21,
                 from media-git/arch/x86/include/asm/cpufeature.h:5,
                 from media-git/arch/x86/include/asm/thread_info.h:53,
                 from media-git/include/linux/thread_info.h:38,
                 from media-git/arch/x86/include/asm/preempt.h:7,
                 from media-git/include/linux/preempt.h:81,
                 from media-git/include/linux/spinlock.h:51,
                 from media-git/include/linux/seqlock.h:36,
                 from media-git/include/linux/time.h:6,
                 from media-git/include/linux/stat.h:19,
                 from media-git/include/linux/module.h:10,
                 from media-git/drivers/staging/media/zoran/zoran_driver.c:44:
In function 'strncpy',
    inlined from 'zoran_querycap' at media-git/drivers/staging/media/zoran/zoran_driver.c:1512:2:
media-git/include/linux/string.h:246:9: warning: '__builtin_strncpy' output may be truncated copying 31 bytes from a string of length 31 [-Wstringop-truncation]
  return __builtin_strncpy(p, q, size);
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
drivers/staging/media/zoran/zoran_driver.c

index 14f9c0e26a1c5bd09f7e22d4b34e7d1d7e44a9ad..d2e13fffbc6be8d8b6c9d3be3f4efaaeb7601fac 100644 (file)
@@ -1509,8 +1509,8 @@ static int zoran_querycap(struct file *file, void *__fh, struct v4l2_capability
        struct zoran_fh *fh = __fh;
        struct zoran *zr = fh->zr;
 
-       strncpy(cap->card, ZR_DEVNAME(zr), sizeof(cap->card)-1);
-       strncpy(cap->driver, "zoran", sizeof(cap->driver)-1);
+       strlcpy(cap->card, ZR_DEVNAME(zr), sizeof(cap->card));
+       strlcpy(cap->driver, "zoran", sizeof(cap->driver));
        snprintf(cap->bus_info, sizeof(cap->bus_info), "PCI:%s",
                 pci_name(zr->pci_dev));
        cap->device_caps = V4L2_CAP_STREAMING | V4L2_CAP_VIDEO_CAPTURE |