[jassibrar-mailbox:for-next 22/22] drivers/mailbox/axiado-mailbox.c:325:39: warning: '-errors' directive output may be truncated writing 7 bytes into a region of size between 2 and 11

kernel test robot <[email protected]>
Newsgroups dev.linux.lists.oe-kbuild-all
Message-ID <[email protected]>
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/jassibrar/mailbox.git for-next
head:   14af7a96afa39f4f3c1972705489b9ba15c01857
commit: 14af7a96afa39f4f3c1972705489b9ba15c01857 [22/22] mailbox: add Axiado AX3005 mailbox driver
config: arm64-randconfig-004-20260825 (https://download.01.org/0day-ci/archive/20260825/[email protected]/config)
compiler: aarch64-linux-gcc (GCC) 8.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260825/[email protected]/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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

   drivers/mailbox/axiado-mailbox.c: In function 'axiado_mbox_probe':
>> drivers/mailbox/axiado-mailbox.c:325:39: warning: '-errors' directive output may be truncated writing 7 bytes into a region of size between 2 and 11 [-Wformat-truncation=]
      snprintf(name, sizeof(name), "chan%u-errors", i);
                                          ^~~~~~~
   drivers/mailbox/axiado-mailbox.c:325:3: note: 'snprintf' output between 13 and 22 bytes into a destination of size 16
      snprintf(name, sizeof(name), "chan%u-errors", i);
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


vim +325 drivers/mailbox/axiado-mailbox.c

   266	
   267	static int axiado_mbox_probe(struct platform_device *pdev)
   268	{
   269		const struct axiado_mbox_data *drv_data;
   270		struct axiado_channel_data *ch_data;
   271		struct device *dev = &pdev->dev;
   272		struct axiado_mbox *mb;
   273		unsigned int irq_idx = 0;
   274		unsigned int rx_chan;
   275		unsigned int i;
   276		int ret;
   277	
   278		drv_data = device_get_match_data(dev);
   279		if (!drv_data)
   280			return -ENODEV;
   281	
   282		mb = devm_kzalloc(dev, sizeof(*mb), GFP_KERNEL);
   283		if (!mb)
   284			return -ENOMEM;
   285	
   286		mb->mbox.dev = dev;
   287		mb->mbox.num_chans = drv_data->num_chans;
   288	
   289		mb->mbox.chans = devm_kcalloc(&pdev->dev,
   290					      drv_data->num_chans,
   291					      sizeof(*mb->mbox.chans),
   292					      GFP_KERNEL);
   293		if (!mb->mbox.chans)
   294			return -ENOMEM;
   295	
   296		mb->tx_base = devm_platform_ioremap_resource_byname(pdev, "tx");
   297		if (IS_ERR(mb->tx_base))
   298			return PTR_ERR(mb->tx_base);
   299	
   300		mb->rx_base = devm_platform_ioremap_resource_byname(pdev, "rx");
   301		if (IS_ERR(mb->rx_base))
   302			return PTR_ERR(mb->rx_base);
   303	
   304		ch_data = devm_kcalloc(&pdev->dev,
   305				       drv_data->num_chans,
   306				       sizeof(*ch_data),
   307				       GFP_KERNEL);
   308		if (!ch_data)
   309			return -ENOMEM;
   310	
   311		mb->debugfs_dir = debugfs_create_dir(dev_name(dev), NULL);
   312		ret = devm_add_action_or_reset(dev, axiado_mbox_debugfs_remove,
   313					       mb->debugfs_dir);
   314		if (ret)
   315			return ret;
   316	
   317		for (i = 0; i < drv_data->num_chans; i++) {
   318			char name[16];
   319	
   320			ch_data[i].channel_num = i;
   321			ch_data[i].chan = &mb->mbox.chans[i];
   322	
   323			mb->mbox.chans[i].con_priv = &ch_data[i];
   324	
 > 325			snprintf(name, sizeof(name), "chan%u-errors", i);
   326			debugfs_create_atomic_t(name, 0444, mb->debugfs_dir,
   327						&ch_data[i].fifo_errors);
   328	
   329			if (i < AXIADO_MBOX_TX_CHANS) {
   330				ch_data[i].mbox_reg = mb->tx_base + (i * AXIADO_MBOX_CHAN_STRIDE);
   331				ch_data[i].csr_reg = mb->tx_base + AXIADO_MBOX_TX_REG_STRIDE +
   332						       (i * AXIADO_MBOX_CHAN_STRIDE);
   333				ch_data[i].irq = -1;
   334				continue;
   335			}
   336	
   337			ch_data[i].rx_buffer = devm_kzalloc(dev, drv_data->msg_size,
   338							    GFP_KERNEL);
   339			if (!ch_data[i].rx_buffer)
   340				return -ENOMEM;
   341	
   342			rx_chan = i - AXIADO_MBOX_TX_CHANS;
   343			ch_data[i].mbox_reg = mb->rx_base +
   344					       (rx_chan * AXIADO_MBOX_CHAN_STRIDE);
   345			ch_data[i].csr_reg = mb->rx_base + AXIADO_MBOX_RX_REG_STRIDE +
   346					      (rx_chan * AXIADO_MBOX_CHAN_STRIDE);
   347			ch_data[i].irq = platform_get_irq(pdev, irq_idx++);
   348			if (ch_data[i].irq < 0)
   349				return dev_err_probe(dev, ch_data[i].irq,
   350						     "Failed to get IRQ for channel %u\n", i);
   351	
   352			ret = devm_request_threaded_irq(dev, ch_data[i].irq, NULL,
   353							axiado_rx_thread,
   354							IRQF_ONESHOT | IRQF_NO_AUTOEN,
   355							dev_name(dev), &ch_data[i]);
   356			if (ret)
   357				return dev_err_probe(dev, ret,
   358						     "Failed to request IRQ for channel %u\n", i);
   359	
   360			dev_dbg(dev, "RX chan %u -> irq %d\n", i, ch_data[i].irq);
   361		}
   362	
   363		platform_set_drvdata(pdev, mb);
   364		mb->drv_data = drv_data;
   365		mb->mbox.ops = &axiado_mbox_chan_ops;
   366		mb->mbox.txdone_irq = false;
   367		mb->mbox.txdone_poll = true;
   368		mb->mbox.txpoll_period = 5;
   369	
   370		return devm_mbox_controller_register(dev, &mb->mbox);
   371	}
   372	

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.