All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Marek Vasut <marex@denx.de>
Cc: oe-kbuild-all@lists.linux.dev, linux-kernel@vger.kernel.org,
	Stephen Boyd <sboyd@kernel.org>
Subject: drivers/clk/clk-si521xx.c:318:26: warning: '%d' directive output may be truncated writing between 1 and 10 bytes into a region of size 2
Date: Thu, 26 Oct 2023 04:34:45 +0800	[thread overview]
Message-ID: <202310260412.AGASjFN4-lkp@intel.com> (raw)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   611da07b89fdd53f140d7b33013f255bf0ed8f34
commit: edc12763a3a29836b23c4fc97a1207baea1d11e8 clk: si521xx: Clock driver for Skyworks Si521xx I2C PCIe clock generators
date:   7 months ago
config: x86_64-buildonly-randconfig-004-20231026 (https://download.01.org/0day-ci/archive/20231026/202310260412.AGASjFN4-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/20231026/202310260412.AGASjFN4-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/202310260412.AGASjFN4-lkp@intel.com/

All warnings (new ones prefixed by >>):

   drivers/clk/clk-si521xx.c: In function 'si521xx_probe':
>> drivers/clk/clk-si521xx.c:318:26: warning: '%d' directive output may be truncated writing between 1 and 10 bytes into a region of size 2 [-Wformat-truncation=]
      snprintf(name, 6, "DIFF%d", i);
                             ^~
   drivers/clk/clk-si521xx.c:318:21: note: directive argument in the range [0, 2147483647]
      snprintf(name, 6, "DIFF%d", i);
                        ^~~~~~~~
   drivers/clk/clk-si521xx.c:318:3: note: 'snprintf' output between 6 and 15 bytes into a destination of size 6
      snprintf(name, 6, "DIFF%d", i);
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


vim +318 drivers/clk/clk-si521xx.c

   279	
   280	static int si521xx_probe(struct i2c_client *client)
   281	{
   282		const u16 chip_info = (u16)(uintptr_t)device_get_match_data(&client->dev);
   283		const struct clk_parent_data clk_parent_data = { .index = 0 };
   284		struct si521xx *si;
   285		unsigned char name[6] = "DIFF0";
   286		struct clk_init_data init = {};
   287		int i, ret;
   288	
   289		if (!chip_info)
   290			return -EINVAL;
   291	
   292		si = devm_kzalloc(&client->dev, sizeof(*si), GFP_KERNEL);
   293		if (!si)
   294			return -ENOMEM;
   295	
   296		i2c_set_clientdata(client, si);
   297		si->client = client;
   298	
   299		/* Fetch common configuration from DT (if specified) */
   300		ret = si521xx_get_common_config(si);
   301		if (ret)
   302			return ret;
   303	
   304		si->regmap = devm_regmap_init(&client->dev, NULL, client,
   305					      &si521xx_regmap_config);
   306		if (IS_ERR(si->regmap))
   307			return dev_err_probe(&client->dev, PTR_ERR(si->regmap),
   308					     "Failed to allocate register map\n");
   309	
   310		/* Always read back 1 Byte via I2C */
   311		ret = regmap_write(si->regmap, SI521XX_REG_BC, 1);
   312		if (ret < 0)
   313			return ret;
   314	
   315		/* Register clock */
   316		for (i = 0; i < hweight16(chip_info); i++) {
   317			memset(&init, 0, sizeof(init));
 > 318			snprintf(name, 6, "DIFF%d", i);
   319			init.name = name;
   320			init.ops = &si521xx_diff_clk_ops;
   321			init.parent_data = &clk_parent_data;
   322			init.num_parents = 1;
   323			init.flags = CLK_SET_RATE_PARENT;
   324	
   325			si->clk_dif[i].hw.init = &init;
   326			si->clk_dif[i].si = si;
   327	
   328			si521xx_diff_idx_to_reg_bit(chip_info, i, &si->clk_dif[i]);
   329	
   330			ret = devm_clk_hw_register(&client->dev, &si->clk_dif[i].hw);
   331			if (ret)
   332				return ret;
   333		}
   334	
   335		ret = devm_of_clk_add_hw_provider(&client->dev, si521xx_of_clk_get, si);
   336		if (!ret)
   337			si521xx_update_config(si);
   338	
   339		return ret;
   340	}
   341	

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

                 reply	other threads:[~2023-10-25 20:35 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=202310260412.AGASjFN4-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marex@denx.de \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=sboyd@kernel.org \
    /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.