[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202312051441.oET2UCAw-lkp@intel.com>
Date: Tue, 5 Dec 2023 14:36:15 +0800
From: kernel test robot <lkp@...el.com>
To: Ioana Ciornei <ioana.ciornei@....com>
Cc: oe-kbuild-all@...ts.linux.dev, linux-kernel@...r.kernel.org
Subject: drivers/net/ethernet/freescale/dpaa2/dpaa2-eth-debugfs.c:135:42:
warning: '%d' directive output may be truncated writing between 1 and 10
bytes into a region of size 7
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: bee0e7762ad2c6025b9f5245c040fcc36ef2bde8
commit: b1dd9bf6ead81bfb910de1df3be74e9d176cae47 net: dpaa2-eth: export buffer pool info into a new debugfs file
date: 1 year, 1 month ago
config: x86_64-buildonly-randconfig-002-20231205 (https://download.01.org/0day-ci/archive/20231205/202312051441.oET2UCAw-lkp@intel.com/config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231205/202312051441.oET2UCAw-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@...el.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202312051441.oET2UCAw-lkp@intel.com/
All warnings (new ones prefixed by >>):
drivers/net/ethernet/freescale/dpaa2/dpaa2-eth-debugfs.c: In function 'dpaa2_dbg_bp_show':
>> drivers/net/ethernet/freescale/dpaa2/dpaa2-eth-debugfs.c:135:42: warning: '%d' directive output may be truncated writing between 1 and 10 bytes into a region of size 7 [-Wformat-truncation=]
135 | snprintf(ch_name, sizeof(ch_name), "CH#%d", i);
| ^~
drivers/net/ethernet/freescale/dpaa2/dpaa2-eth-debugfs.c:135:38: note: directive argument in the range [0, 2147483646]
135 | snprintf(ch_name, sizeof(ch_name), "CH#%d", i);
| ^~~~~~~
drivers/net/ethernet/freescale/dpaa2/dpaa2-eth-debugfs.c:135:3: note: 'snprintf' output between 5 and 14 bytes into a destination of size 10
135 | snprintf(ch_name, sizeof(ch_name), "CH#%d", i);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
vim +135 drivers/net/ethernet/freescale/dpaa2/dpaa2-eth-debugfs.c
121
122 static int dpaa2_dbg_bp_show(struct seq_file *file, void *offset)
123 {
124 struct dpaa2_eth_priv *priv = (struct dpaa2_eth_priv *)file->private;
125 int i, j, num_queues, buf_cnt;
126 struct dpaa2_eth_bp *bp;
127 char ch_name[10];
128 int err;
129
130 /* Print out the header */
131 seq_printf(file, "Buffer pool info for %s:\n", priv->net_dev->name);
132 seq_printf(file, "%s %10s%15s", "IDX", "BPID", "Buf count");
133 num_queues = dpaa2_eth_queue_count(priv);
134 for (i = 0; i < num_queues; i++) {
> 135 snprintf(ch_name, sizeof(ch_name), "CH#%d", i);
136 seq_printf(file, "%10s", ch_name);
137 }
138 seq_printf(file, "\n");
139
140 /* For each buffer pool, print out its BPID, the number of buffers in
141 * that buffer pool and the channels which are using it.
142 */
143 for (i = 0; i < priv->num_bps; i++) {
144 bp = priv->bp[i];
145
146 err = dpaa2_io_query_bp_count(NULL, bp->bpid, &buf_cnt);
147 if (err) {
148 netdev_warn(priv->net_dev, "Buffer count query error %d\n", err);
149 return err;
150 }
151
152 seq_printf(file, "%3s%d%10d%15d", "BP#", i, bp->bpid, buf_cnt);
153 for (j = 0; j < num_queues; j++) {
154 if (priv->channel[j]->bp == bp)
155 seq_printf(file, "%10s", "x");
156 else
157 seq_printf(file, "%10s", "");
158 }
159 seq_printf(file, "\n");
160 }
161
162 return 0;
163 }
164
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
Powered by blists - more mailing lists