public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Chester Lin <clin@suse.com>
Cc: oe-kbuild-all@lists.linux.dev, linux-kernel@vger.kernel.org,
	Linus Walleij <linus.walleij@linaro.org>,
	Matthew Nunez <matthew.nunez@nxp.com>,
	Phu Luu An <phu.luuan@nxp.com>,
	Stefan-Gabriel Mirea <stefan-gabriel.mirea@nxp.com>,
	Larisa Grigore <larisa.grigore@nxp.com>,
	Ghennadi Procopciuc <Ghennadi.Procopciuc@oss.nxp.com>,
	Andrei Stefanescu <andrei.stefanescu@nxp.com>,
	Radu Pirea <radu-nicolae.pirea@nxp.com>
Subject: drivers/pinctrl/nxp/pinctrl-s32cc.c:830:62: warning: '%u' directive output may be truncated writing between 1 and 10 bytes into a region of size 5
Date: Fri, 3 Nov 2023 01:44:36 +0800	[thread overview]
Message-ID: <202311030159.iyUGjNGF-lkp@intel.com> (raw)

Hi Chester,

FYI, the error/warning still remains.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   21e80f3841c01aeaf32d7aee7bbc87b3db1aa0c6
commit: fd84aaa8173d3ff86f8df2009921336a1ea53a8a pinctrl: add NXP S32 SoC family support
date:   8 months ago
config: arm64-allmodconfig (https://download.01.org/0day-ci/archive/20231103/202311030159.iyUGjNGF-lkp@intel.com/config)
compiler: aarch64-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231103/202311030159.iyUGjNGF-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/202311030159.iyUGjNGF-lkp@intel.com/

All warnings (new ones prefixed by >>):

   drivers/pinctrl/nxp/pinctrl-s32cc.c: In function 's32_pinctrl_probe_dt':
>> drivers/pinctrl/nxp/pinctrl-s32cc.c:830:62: warning: '%u' directive output may be truncated writing between 1 and 10 bytes into a region of size 5 [-Wformat-truncation=]
     830 |                          sizeof(ipctl->regions[i].name), "map%u", i);
         |                                                              ^~
   drivers/pinctrl/nxp/pinctrl-s32cc.c:830:58: note: directive argument in the range [0, 4294967294]
     830 |                          sizeof(ipctl->regions[i].name), "map%u", i);
         |                                                          ^~~~~~~
   drivers/pinctrl/nxp/pinctrl-s32cc.c:829:17: note: 'snprintf' output between 5 and 14 bytes into a destination of size 8
     829 |                 snprintf(ipctl->regions[i].name,
         |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     830 |                          sizeof(ipctl->regions[i].name), "map%u", i);
         |                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


vim +830 drivers/pinctrl/nxp/pinctrl-s32cc.c

   796	
   797	static int s32_pinctrl_probe_dt(struct platform_device *pdev,
   798					struct s32_pinctrl *ipctl)
   799	{
   800		struct s32_pinctrl_soc_info *info = ipctl->info;
   801		struct device_node *np = pdev->dev.of_node;
   802		struct device_node *child;
   803		struct resource *res;
   804		struct regmap *map;
   805		void __iomem *base;
   806		int mem_regions = info->mem_regions;
   807		u32 nfuncs = 0;
   808		u32 i = 0;
   809	
   810		if (!np)
   811			return -ENODEV;
   812	
   813		if (mem_regions == 0) {
   814			dev_err(&pdev->dev, "mem_regions is 0\n");
   815			return -EINVAL;
   816		}
   817	
   818		ipctl->regions = devm_kzalloc(&pdev->dev,
   819					      mem_regions * sizeof(*(ipctl->regions)),
   820					      GFP_KERNEL);
   821		if (!ipctl->regions)
   822			return -ENOMEM;
   823	
   824		for (i = 0; i < mem_regions; ++i) {
   825			base = devm_platform_get_and_ioremap_resource(pdev, i, &res);
   826			if (IS_ERR(base))
   827				return PTR_ERR(base);
   828	
   829			snprintf(ipctl->regions[i].name,
 > 830				 sizeof(ipctl->regions[i].name), "map%u", i);
   831	
   832			s32_regmap_config.name = ipctl->regions[i].name;
   833			s32_regmap_config.max_register = resource_size(res) -
   834							 s32_regmap_config.reg_stride;
   835	
   836			map = devm_regmap_init_mmio(&pdev->dev, base,
   837							&s32_regmap_config);
   838			if (IS_ERR(map)) {
   839				dev_err(&pdev->dev, "Failed to init regmap[%u]\n", i);
   840				return PTR_ERR(map);
   841			}
   842	
   843			ipctl->regions[i].map = map;
   844			ipctl->regions[i].pin_range = &info->mem_pin_ranges[i];
   845		}
   846	
   847		nfuncs = of_get_child_count(np);
   848		if (nfuncs <= 0) {
   849			dev_err(&pdev->dev, "no functions defined\n");
   850			return -EINVAL;
   851		}
   852	
   853		info->nfunctions = nfuncs;
   854		info->functions = devm_kzalloc(&pdev->dev,
   855					       nfuncs * sizeof(struct s32_pmx_func),
   856					       GFP_KERNEL);
   857		if (!info->functions)
   858			return -ENOMEM;
   859	
   860		info->ngroups = 0;
   861		for_each_child_of_node(np, child)
   862			info->ngroups += of_get_child_count(child);
   863		info->groups = devm_kzalloc(&pdev->dev,
   864					    info->ngroups * sizeof(struct s32_pin_group),
   865					    GFP_KERNEL);
   866		if (!info->groups)
   867			return -ENOMEM;
   868	
   869		i = 0;
   870		for_each_child_of_node(np, child)
   871			s32_pinctrl_parse_functions(child, info, i++);
   872	
   873		return 0;
   874	}
   875	

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

             reply	other threads:[~2023-11-02 17:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-02 17:44 kernel test robot [this message]
  -- strict thread matches above, loose matches on Subject: below --
2023-10-18 12:06 drivers/pinctrl/nxp/pinctrl-s32cc.c:830:62: warning: '%u' directive output may be truncated writing between 1 and 10 bytes into a region of size 5 kernel test robot

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=202311030159.iyUGjNGF-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=Ghennadi.Procopciuc@oss.nxp.com \
    --cc=andrei.stefanescu@nxp.com \
    --cc=clin@suse.com \
    --cc=larisa.grigore@nxp.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matthew.nunez@nxp.com \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=phu.luuan@nxp.com \
    --cc=radu-nicolae.pirea@nxp.com \
    --cc=stefan-gabriel.mirea@nxp.com \
    /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