From: kernel test robot <lkp@intel.com>
To: Simon Horman <horms@kernel.org>
Cc: oe-kbuild-all@lists.linux.dev, linux-kernel@vger.kernel.org,
Jakub Kicinski <kuba@kernel.org>,
Vadim Fedorenko <vadim.fedorenko@linux.dev>
Subject: drivers/net/ethernet/marvell/octeontx2/af/cgx.c:1737:49: warning: '%u' directive writing between 1 and 10 bytes into a region of size between 4 and 6
Date: Wed, 27 May 2026 23:59:56 +0800 [thread overview]
Message-ID: <202605272344.nd50Aa2d-lkp@intel.com> (raw)
Hi Simon,
FYI, the error/warning was bisected to this commit, please ignore it if it's irrelevant.
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: eb3f4b7426cfd2b79d65b7d37155480b32259a11
commit: 9312ee76490df61491fee19b5ce71f71b6de908c octeontx2-af: use unsigned int as iterator for unsigned values
date: 10 months ago
config: riscv-randconfig-r073-20260527 (https://download.01.org/0day-ci/archive/20260527/202605272344.nd50Aa2d-lkp@intel.com/config)
compiler: riscv64-linux-gcc (GCC) 11.5.0
smatch: v0.5.0-9185-gbcc58b9c
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260527/202605272344.nd50Aa2d-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
| Fixes: 9312ee76490d ("octeontx2-af: use unsigned int as iterator for unsigned values")
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202605272344.nd50Aa2d-lkp@intel.com/
All warnings (new ones prefixed by >>):
drivers/net/ethernet/marvell/octeontx2/af/cgx.c: In function 'cgx_lmac_init':
>> drivers/net/ethernet/marvell/octeontx2/af/cgx.c:1737:49: warning: '%u' directive writing between 1 and 10 bytes into a region of size between 4 and 6 [-Wformat-overflow=]
1737 | sprintf(lmac->name, "cgx_fwi_%u_%u", cgx->cgx_id, i);
| ^~
drivers/net/ethernet/marvell/octeontx2/af/cgx.c:1737:37: note: directive argument in the range [0, 4294967294]
1737 | sprintf(lmac->name, "cgx_fwi_%u_%u", cgx->cgx_id, i);
| ^~~~~~~~~~~~~~~
drivers/net/ethernet/marvell/octeontx2/af/cgx.c:1737:17: note: 'sprintf' output between 12 and 23 bytes into a destination of size 16
1737 | sprintf(lmac->name, "cgx_fwi_%u_%u", cgx->cgx_id, i);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
vim +1737 drivers/net/ethernet/marvell/octeontx2/af/cgx.c
1704
1705 static int cgx_lmac_init(struct cgx *cgx)
1706 {
1707 u8 max_dmac_filters;
1708 struct lmac *lmac;
1709 int err, filter;
1710 unsigned int i;
1711 u64 lmac_list;
1712
1713 /* lmac_list specifies which lmacs are enabled
1714 * when bit n is set to 1, LMAC[n] is enabled
1715 */
1716 if (cgx->mac_ops->non_contiguous_serdes_lane) {
1717 if (is_dev_rpm2(cgx))
1718 lmac_list =
1719 cgx_read(cgx, 0, RPM2_CMRX_RX_LMACS) & 0xFFULL;
1720 else
1721 lmac_list =
1722 cgx_read(cgx, 0, CGXX_CMRX_RX_LMACS) & 0xFULL;
1723 }
1724
1725 if (cgx->lmac_count > cgx->max_lmac_per_mac)
1726 cgx->lmac_count = cgx->max_lmac_per_mac;
1727
1728 for (i = 0; i < cgx->lmac_count; i++) {
1729 lmac = kzalloc(sizeof(struct lmac), GFP_KERNEL);
1730 if (!lmac)
1731 return -ENOMEM;
1732 lmac->name = kcalloc(1, sizeof("cgx_fwi_xxx_yyy"), GFP_KERNEL);
1733 if (!lmac->name) {
1734 err = -ENOMEM;
1735 goto err_lmac_free;
1736 }
> 1737 sprintf(lmac->name, "cgx_fwi_%u_%u", cgx->cgx_id, i);
1738 if (cgx->mac_ops->non_contiguous_serdes_lane) {
1739 lmac->lmac_id = __ffs64(lmac_list);
1740 lmac_list &= ~BIT_ULL(lmac->lmac_id);
1741 } else {
1742 lmac->lmac_id = i;
1743 }
1744
1745 lmac->cgx = cgx;
1746 lmac->mac_to_index_bmap.max =
1747 cgx->mac_ops->dmac_filter_count /
1748 cgx->lmac_count;
1749
1750 max_dmac_filters = lmac->mac_to_index_bmap.max;
1751
1752 err = rvu_alloc_bitmap(&lmac->mac_to_index_bmap);
1753 if (err)
1754 goto err_name_free;
1755
1756 /* Reserve first entry for default MAC address */
1757 set_bit(0, lmac->mac_to_index_bmap.bmap);
1758
1759 lmac->rx_fc_pfvf_bmap.max = 128;
1760 err = rvu_alloc_bitmap(&lmac->rx_fc_pfvf_bmap);
1761 if (err)
1762 goto err_dmac_bmap_free;
1763
1764 lmac->tx_fc_pfvf_bmap.max = 128;
1765 err = rvu_alloc_bitmap(&lmac->tx_fc_pfvf_bmap);
1766 if (err)
1767 goto err_rx_fc_bmap_free;
1768
1769 init_waitqueue_head(&lmac->wq_cmd_cmplt);
1770 mutex_init(&lmac->cmd_lock);
1771 spin_lock_init(&lmac->event_cb_lock);
1772 err = cgx_configure_interrupt(cgx, lmac, lmac->lmac_id, false);
1773 if (err)
1774 goto err_bitmap_free;
1775
1776 /* Add reference */
1777 cgx->lmac_idmap[lmac->lmac_id] = lmac;
1778 set_bit(lmac->lmac_id, &cgx->lmac_bmap);
1779 cgx->mac_ops->mac_pause_frm_config(cgx, lmac->lmac_id, true);
1780 lmac->lmac_type = cgx->mac_ops->get_lmac_type(cgx, lmac->lmac_id);
1781
1782 /* Disable stale DMAC filters for sane state */
1783 for (filter = 0; filter < max_dmac_filters; filter++)
1784 cgx_lmac_addr_del(cgx->cgx_id, lmac->lmac_id, filter);
1785
1786 /* As cgx_lmac_addr_del does not clear entry for index 0
1787 * so it needs to be done explicitly
1788 */
1789 cgx_lmac_addr_reset(cgx->cgx_id, lmac->lmac_id);
1790 }
1791
1792 /* Start X2P reset on given MAC block */
1793 cgx->mac_ops->mac_x2p_reset(cgx, true);
1794 return cgx_lmac_verify_fwi_version(cgx);
1795
1796 err_bitmap_free:
1797 rvu_free_bitmap(&lmac->tx_fc_pfvf_bmap);
1798 err_rx_fc_bmap_free:
1799 rvu_free_bitmap(&lmac->rx_fc_pfvf_bmap);
1800 err_dmac_bmap_free:
1801 rvu_free_bitmap(&lmac->mac_to_index_bmap);
1802 err_name_free:
1803 kfree(lmac->name);
1804 err_lmac_free:
1805 kfree(lmac);
1806 return err;
1807 }
1808
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
reply other threads:[~2026-05-27 16:00 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=202605272344.nd50Aa2d-lkp@intel.com \
--to=lkp@intel.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=oe-kbuild-all@lists.linux.dev \
--cc=vadim.fedorenko@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 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.