All of lore.kernel.org
 help / color / mirror / Atom feed
* [intel-lts:5.15/linux 44/67] drivers/media/i2c/d4xx.c:4580:2: warning: 'snprintf' will always be truncated; specified size is 20, but format string expands to at least 23
@ 2024-02-03 10:34 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2024-02-03 10:34 UTC (permalink / raw)
  To: zouxiaoh; +Cc: oe-kbuild-all, Ranjan Dutta, Dmitry Perchanov

tree:   https://github.com/intel/linux-intel-lts.git 5.15/linux
head:   b2769cf869322589ab9147c774404f1f62b6561d
commit: db4067cbf480f22e8b0b0ef4467bb6e69e65250e [44/67] media: i2c: d4xx: Update to match RealSense latest code.
config: s390-allmodconfig (https://download.01.org/0day-ci/archive/20240203/202402031810.ph4BUF0b-lkp@intel.com/config)
compiler: clang version 19.0.0git (https://github.com/llvm/llvm-project fdac7d0b6f74f919d319b31a0680c77f66732586)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240203/202402031810.ph4BUF0b-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/202402031810.ph4BUF0b-lkp@intel.com/

All warnings (new ones prefixed by >>):

   In file included from include/asm-generic/gpio.h:11:
   In file included from include/linux/gpio/driver.h:7:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:13:
   In file included from arch/s390/include/asm/io.h:75:
   include/asm-generic/io.h:464:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     464 |         val = __raw_readb(PCI_IOBASE + addr);
         |                           ~~~~~~~~~~ ^
   include/asm-generic/io.h:477:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     477 |         val = __le16_to_cpu((__le16 __force)__raw_readw(PCI_IOBASE + addr));
         |                                                         ~~~~~~~~~~ ^
   include/uapi/linux/byteorder/big_endian.h:37:59: note: expanded from macro '__le16_to_cpu'
      37 | #define __le16_to_cpu(x) __swab16((__force __u16)(__le16)(x))
         |                                                           ^
   include/uapi/linux/swab.h:102:54: note: expanded from macro '__swab16'
     102 | #define __swab16(x) (__u16)__builtin_bswap16((__u16)(x))
         |                                                      ^
   In file included from drivers/media/i2c/d4xx.c:21:
   In file included from include/linux/gpio.h:62:
   In file included from include/asm-generic/gpio.h:11:
   In file included from include/linux/gpio/driver.h:7:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:13:
   In file included from arch/s390/include/asm/io.h:75:
   include/asm-generic/io.h:490:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     490 |         val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr));
         |                                                         ~~~~~~~~~~ ^
   include/uapi/linux/byteorder/big_endian.h:35:59: note: expanded from macro '__le32_to_cpu'
      35 | #define __le32_to_cpu(x) __swab32((__force __u32)(__le32)(x))
         |                                                           ^
   include/uapi/linux/swab.h:115:54: note: expanded from macro '__swab32'
     115 | #define __swab32(x) (__u32)__builtin_bswap32((__u32)(x))
         |                                                      ^
   In file included from drivers/media/i2c/d4xx.c:21:
   In file included from include/linux/gpio.h:62:
   In file included from include/asm-generic/gpio.h:11:
   In file included from include/linux/gpio/driver.h:7:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:13:
   In file included from arch/s390/include/asm/io.h:75:
   include/asm-generic/io.h:501:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     501 |         __raw_writeb(value, PCI_IOBASE + addr);
         |                             ~~~~~~~~~~ ^
   include/asm-generic/io.h:511:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     511 |         __raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr);
         |                                                       ~~~~~~~~~~ ^
   include/asm-generic/io.h:521:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     521 |         __raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr);
         |                                                       ~~~~~~~~~~ ^
   include/asm-generic/io.h:609:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     609 |         readsb(PCI_IOBASE + addr, buffer, count);
         |                ~~~~~~~~~~ ^
   include/asm-generic/io.h:617:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     617 |         readsw(PCI_IOBASE + addr, buffer, count);
         |                ~~~~~~~~~~ ^
   include/asm-generic/io.h:625:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     625 |         readsl(PCI_IOBASE + addr, buffer, count);
         |                ~~~~~~~~~~ ^
   include/asm-generic/io.h:634:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     634 |         writesb(PCI_IOBASE + addr, buffer, count);
         |                 ~~~~~~~~~~ ^
   include/asm-generic/io.h:643:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     643 |         writesw(PCI_IOBASE + addr, buffer, count);
         |                 ~~~~~~~~~~ ^
   include/asm-generic/io.h:652:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     652 |         writesl(PCI_IOBASE + addr, buffer, count);
         |                 ~~~~~~~~~~ ^
   drivers/media/i2c/d4xx.c:2917:10: warning: initializer overrides prior initialization of this subobject [-Winitializer-overrides]
    2917 |         .step = 1,
         |                 ^
   drivers/media/i2c/d4xx.c:2916:10: note: previous initialization is here
    2916 |         .step = 1,
         |                 ^
   drivers/media/i2c/d4xx.c:2931:10: warning: initializer overrides prior initialization of this subobject [-Winitializer-overrides]
    2931 |         .step = 1,
         |                 ^
   drivers/media/i2c/d4xx.c:2930:10: note: previous initialization is here
    2930 |         .step = 1,
         |                 ^
   drivers/media/i2c/d4xx.c:2945:10: warning: initializer overrides prior initialization of this subobject [-Winitializer-overrides]
    2945 |         .step = 1,
         |                 ^
   drivers/media/i2c/d4xx.c:2944:10: note: previous initialization is here
    2944 |         .step = 1,
         |                 ^
   drivers/media/i2c/d4xx.c:3231:67: error: no member named 'subdev_info' in 'struct d4xx_pdata'
    3231 |         snprintf(sd->name, sizeof(sd->name), "D4XX %s %c", name, dpdata->subdev_info[0].suffix);
         |                                                                  ~~~~~~  ^
   drivers/media/i2c/d4xx.c:3222:21: warning: mixing declarations and code is a C99 extension [-Wdeclaration-after-statement]
    3222 |         struct d4xx_pdata *dpdata = c->dev.platform_data;
         |                            ^
   drivers/media/i2c/d4xx.c:3658:46: warning: variable 'stream_id' set but not used [-Wunused-but-set-variable]
    3658 |         u16 config_status_base, stream_status_base, stream_id;
         |                                                     ^
   drivers/media/i2c/d4xx.c:3799:46: warning: variable 'stream_id' set but not used [-Wunused-but-set-variable]
    3799 |         u16 config_status_base, stream_status_base, stream_id;
         |                                                     ^
   drivers/media/i2c/d4xx.c:4146:22: warning: unused variable 'sd' [-Wunused-variable]
    4146 |         struct v4l2_subdev *sd = &state->mux.sd.subdev;
         |                             ^~
>> drivers/media/i2c/d4xx.c:4580:2: warning: 'snprintf' will always be truncated; specified size is 20, but format string expands to at least 23 [-Wformat-truncation]
    4580 |         snprintf(msg, sizeof(msg), "DFU info: \tver: (0x%x)\n", fw_ver);
         |         ^
   drivers/media/i2c/d4xx.c:4682:22: warning: unused variable 'parent' [-Wunused-variable]
    4682 |         struct i2c_adapter *parent = i2c_parent_is_i2c_adapter(
         |                             ^~~~~~
   drivers/media/i2c/d4xx.c:5055:14: error: no member named 'subdev_num' in 'struct d4xx_pdata'
    5055 |         if (dpdata->subdev_num >= 1) {
         |             ~~~~~~  ^
   drivers/media/i2c/d4xx.c:5056:26: error: no member named 'subdev_info' in 'struct d4xx_pdata'
    5056 |                 sensor_alias = dpdata->subdev_info[0].board_info.addr;
         |                                ~~~~~~  ^
   drivers/media/i2c/d4xx.c:5057:23: error: no member named 'subdev_info' in 'struct d4xx_pdata'
    5057 |                 ser_alias = dpdata->subdev_info[0].ser_alias;
         |                             ~~~~~~  ^
   21 warnings and 4 errors generated.

Kconfig warnings: (for reference only)
   WARNING: unmet direct dependencies detected for INTEL_PMC_CORE
   Depends on [n]: X86 && X86_PLATFORM_DEVICES [=n] && PCI [=y] && ACPI
   Selected by [m]:
   - DWMAC_INTEL_PLAT [=m] && NETDEVICES [=y] && ETHERNET [=y] && NET_VENDOR_STMICRO [=y] && STMMAC_PLATFORM [=m] && OF [=y] && COMMON_CLK [=y] && STMMAC_ETH [=m]


vim +/snprintf +4580 drivers/media/i2c/d4xx.c

  4565	
  4566	/* When a process reads from our device, this gets called. */
  4567	static ssize_t ds5_dfu_device_read(struct file *flip,
  4568			char __user *buffer, size_t len, loff_t *offset)
  4569	{
  4570		struct ds5 *state = flip->private_data;
  4571		u16 fw_ver;
  4572		char msg[20];
  4573		int ret = 0;
  4574	
  4575		if (mutex_lock_interruptible(&state->lock))
  4576			return -ERESTARTSYS;
  4577		ret = ds5_read(state, DS5_FW_VERSION, &fw_ver);
  4578		if (ret < 0)
  4579			goto e_dfu_read_failed;
> 4580		snprintf(msg, sizeof(msg), "DFU info: \tver: (0x%x)\n", fw_ver);
  4581		if (copy_to_user(buffer, msg, strlen(msg)))
  4582			ret = -EFAULT;
  4583		else {
  4584			state->dfu_dev.msg_write_once = ~state->dfu_dev.msg_write_once;
  4585			ret = strlen(msg) & state->dfu_dev.msg_write_once;
  4586		}
  4587	
  4588	e_dfu_read_failed:
  4589		mutex_unlock(&state->lock);
  4590		return ret;
  4591	};
  4592	

-- 
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-02-03 10:35 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-03 10:34 [intel-lts:5.15/linux 44/67] drivers/media/i2c/d4xx.c:4580:2: warning: 'snprintf' will always be truncated; specified size is 20, but format string expands to at least 23 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.