mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Ioana Ciornei <ioana.ciornei@nxp.com>
Cc: oe-kbuild-all@lists.linux.dev, linux-kernel@vger.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
Date: Tue, 5 Dec 2023 14:36:15 +0800	[thread overview]
Message-ID: <202312051441.oET2UCAw-lkp@intel.com> (raw)

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@intel.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

                 reply	other threads:[~2023-12-05  6:37 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=202312051441.oET2UCAw-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=ioana.ciornei@nxp.com \
    --cc=linux-kernel@vger.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®