lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202310181926.olw9ysCc-lkp@intel.com>
Date:   Wed, 18 Oct 2023 20:06:08 +0800
From:   kernel test robot <lkp@...el.com>
To:     Chester Lin <clin@...e.com>
Cc:     oe-kbuild-all@...ts.linux.dev, linux-kernel@...r.kernel.org,
        Linus Walleij <linus.walleij@...aro.org>,
        Matthew Nunez <matthew.nunez@....com>,
        Phu Luu An <phu.luuan@....com>,
        Stefan-Gabriel Mirea <stefan-gabriel.mirea@....com>,
        Larisa Grigore <larisa.grigore@....com>,
        Ghennadi Procopciuc <Ghennadi.Procopciuc@....nxp.com>,
        Andrei Stefanescu <andrei.stefanescu@....com>,
        Radu Pirea <radu-nicolae.pirea@....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

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   06dc10eae55b5ceabfef287a7e5f16ceea204aa0
commit: fd84aaa8173d3ff86f8df2009921336a1ea53a8a pinctrl: add NXP S32 SoC family support
date:   8 months ago
config: arm64-randconfig-002-20230923 (https://download.01.org/0day-ci/archive/20231018/202310181926.olw9ysCc-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/20231018/202310181926.olw9ysCc-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@...el.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202310181926.olw9ysCc-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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ