drivers/net/ethernet/mellanox/mlx5/core/en/reporter_rx.c:573:46: warning: '%s' directive output may be truncated writing up to 255 bytes into a region of size between 220 and 230

From: kernel test robot
Date: Wed Oct 18 2023 - 09:16:58 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 06dc10eae55b5ceabfef287a7e5f16ceea204aa0
commit: 521f31af004ade74963d551a719a36ca7df0ba70 net/mlx5e: Allow RQ outside of channel context
date: 2 years, 10 months ago
config: x86_64-randconfig-001-20230913 (https://download.01.org/0day-ci/archive/20231018/202310182137.AlBjalaw-lkp@xxxxxxxxx/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231018/202310182137.AlBjalaw-lkp@xxxxxxxxx/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@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202310182137.AlBjalaw-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

drivers/net/ethernet/mellanox/mlx5/core/en/reporter_rx.c: In function 'mlx5e_reporter_rx_timeout':
>> drivers/net/ethernet/mellanox/mlx5/core/en/reporter_rx.c:573:46: warning: '%s' directive output may be truncated writing up to 255 bytes into a region of size between 220 and 230 [-Wformat-truncation=]
573 | "RX timeout on channel: %d, %sRQ: 0x%x, CQ: 0x%x",
| ^~
574 | rq->ix, icosq_str, rq->rqn, rq->cq.mcq.cqn);
| ~~~~~~~~~
drivers/net/ethernet/mellanox/mlx5/core/en/reporter_rx.c:572:9: note: 'snprintf' output between 43 and 322 bytes into a destination of size 256
572 | snprintf(err_str, sizeof(err_str),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
573 | "RX timeout on channel: %d, %sRQ: 0x%x, CQ: 0x%x",
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
574 | rq->ix, icosq_str, rq->rqn, rq->cq.mcq.cqn);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


vim +573 drivers/net/ethernet/mellanox/mlx5/core/en/reporter_rx.c

557
558 void mlx5e_reporter_rx_timeout(struct mlx5e_rq *rq)
559 {
560 char icosq_str[MLX5E_REPORTER_PER_Q_MAX_LEN] = {};
561 char err_str[MLX5E_REPORTER_PER_Q_MAX_LEN];
562 struct mlx5e_icosq *icosq = rq->icosq;
563 struct mlx5e_priv *priv = rq->priv;
564 struct mlx5e_err_ctx err_ctx = {};
565
566 err_ctx.ctx = rq;
567 err_ctx.recover = mlx5e_rx_reporter_timeout_recover;
568 err_ctx.dump = mlx5e_rx_reporter_dump_rq;
569
570 if (icosq)
571 snprintf(icosq_str, sizeof(icosq_str), "ICOSQ: 0x%x, ", icosq->sqn);
572 snprintf(err_str, sizeof(err_str),
> 573 "RX timeout on channel: %d, %sRQ: 0x%x, CQ: 0x%x",
574 rq->ix, icosq_str, rq->rqn, rq->cq.mcq.cqn);
575
576 mlx5e_health_report(priv, priv->rx_reporter, err_str, &err_ctx);
577 }
578

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki