All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Hauke Mehrtens <hauke@hauke-m.de>
Cc: oe-kbuild-all@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: drivers/net/dsa/lantiq_gswip.c:907:44: warning: '%d' directive output may be truncated writing between 1 and 10 bytes into a region of size 6
Date: Thu, 30 Nov 2023 05:36:09 +0800	[thread overview]
Message-ID: <202311300155.M0VzROAp-lkp@intel.com> (raw)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   3b47bc037bd44f142ac09848e8d3ecccc726be99
commit: 14fceff4771e51b23b4485b575cf9e5b3414b89b net: dsa: Add Lantiq / Intel DSA driver for vrx200
date:   5 years ago
config: x86_64-randconfig-r015-20230905 (https://download.01.org/0day-ci/archive/20231130/202311300155.M0VzROAp-lkp@intel.com/config)
compiler: gcc-7 (Ubuntu 7.5.0-6ubuntu2) 7.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231130/202311300155.M0VzROAp-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/202311300155.M0VzROAp-lkp@intel.com/

All warnings (new ones prefixed by >>):

   drivers/net/dsa/lantiq_gswip.c: In function 'gswip_probe':
>> drivers/net/dsa/lantiq_gswip.c:907:44: warning: '%d' directive output may be truncated writing between 1 and 10 bytes into a region of size 6 [-Wformat-truncation=]
     snprintf(gphyname, sizeof(gphyname), "gphy%d", i);
                                               ^~
   drivers/net/dsa/lantiq_gswip.c:907:39: note: directive argument in the range [0, 2147483647]
     snprintf(gphyname, sizeof(gphyname), "gphy%d", i);
                                          ^~~~~~~~
   drivers/net/dsa/lantiq_gswip.c:907:2: note: 'snprintf' output between 6 and 15 bytes into a destination of size 10
     snprintf(gphyname, sizeof(gphyname), "gphy%d", i);
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


vim +907 drivers/net/dsa/lantiq_gswip.c

   897	
   898	static int gswip_gphy_fw_probe(struct gswip_priv *priv,
   899				       struct gswip_gphy_fw *gphy_fw,
   900				       struct device_node *gphy_fw_np, int i)
   901	{
   902		struct device *dev = priv->dev;
   903		u32 gphy_mode;
   904		int ret;
   905		char gphyname[10];
   906	
 > 907		snprintf(gphyname, sizeof(gphyname), "gphy%d", i);
   908	
   909		gphy_fw->clk_gate = devm_clk_get(dev, gphyname);
   910		if (IS_ERR(gphy_fw->clk_gate)) {
   911			dev_err(dev, "Failed to lookup gate clock\n");
   912			return PTR_ERR(gphy_fw->clk_gate);
   913		}
   914	
   915		ret = of_property_read_u32(gphy_fw_np, "reg", &gphy_fw->fw_addr_offset);
   916		if (ret)
   917			return ret;
   918	
   919		ret = of_property_read_u32(gphy_fw_np, "lantiq,gphy-mode", &gphy_mode);
   920		/* Default to GE mode */
   921		if (ret)
   922			gphy_mode = GPHY_MODE_GE;
   923	
   924		switch (gphy_mode) {
   925		case GPHY_MODE_FE:
   926			gphy_fw->fw_name = priv->gphy_fw_name_cfg->fe_firmware_name;
   927			break;
   928		case GPHY_MODE_GE:
   929			gphy_fw->fw_name = priv->gphy_fw_name_cfg->ge_firmware_name;
   930			break;
   931		default:
   932			dev_err(dev, "Unknown GPHY mode %d\n", gphy_mode);
   933			return -EINVAL;
   934		}
   935	
   936		gphy_fw->reset = of_reset_control_array_get_exclusive(gphy_fw_np);
   937		if (IS_ERR(priv->gphy_fw)) {
   938			if (PTR_ERR(priv->gphy_fw) != -EPROBE_DEFER)
   939				dev_err(dev, "Failed to lookup gphy reset\n");
   940			return PTR_ERR(priv->gphy_fw);
   941		}
   942	
   943		return gswip_gphy_fw_load(priv, gphy_fw);
   944	}
   945	

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

                 reply	other threads:[~2023-11-29 21:36 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=202311300155.M0VzROAp-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=hauke@hauke-m.de \
    --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 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.