All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yujie Liu <yujie.liu@intel.com>
To: Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: kernel test robot <lkp@intel.com>,
	"oe-kbuild-all@lists.linux.dev" <oe-kbuild-all@lists.linux.dev>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Michael Ellerman <mpe@ellerman.id.au>
Subject: Re: drivers/power/supply/pmu_battery.c:171:50: warning: '%d' directive writing between 1 and 11 bytes into a region of size 4
Date: Mon, 13 Nov 2023 14:32:55 +0800	[thread overview]
Message-ID: <ZVHDF2yzthb0D0SS@yujie-X299> (raw)
In-Reply-To: <35cd8b05-8687-696a-4b1e-8449616104c1@csgroup.eu>

On Thu, Nov 09, 2023 at 06:23:55PM +0000, Christophe Leroy wrote:
> 
> 
> Le 09/11/2023 à 18:27, kernel test robot a écrit :
> > tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> > head:   6bc986ab839c844e78a2333a02e55f02c9e57935
> > commit: 2edb16efc899f9c232e2d880930b855e4cf55df4 powerpc/32: Add KASAN support
> > date:   4 years, 6 months ago
> 
> Must be something wrong with the robot, this report is absolutely 
> unrelated to the implementation of KASAN support, I can't see why it 
> would pop-up with that commit.

Hi Christophe,

We are investigating this case to understand what went wrong in the
bisection process of the robot. Sorry for the false alarm and please
kindly ignore this report.

> 
> Christophe
> 
> > config: powerpc-randconfig-r031-20211015 (https://download.01.org/0day-ci/archive/20231110/202311100157.2Kn3gHLg-lkp@intel.com/config)
> > compiler: powerpc-linux-gcc (GCC) 12.3.0
> > reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231110/202311100157.2Kn3gHLg-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/202311100157.2Kn3gHLg-lkp@intel.com/
> > 
> > All warnings (new ones prefixed by >>):
> > 
> >     drivers/power/supply/pmu_battery.c: In function 'pmu_bat_init':
> >>> drivers/power/supply/pmu_battery.c:171:50: warning: '%d' directive writing between 1 and 11 bytes into a region of size 4 [-Wformat-overflow=]
> >       171 |                 sprintf(pbat->name, "PMU_battery_%d", i);
> >           |                                                  ^~
> >     drivers/power/supply/pmu_battery.c:171:37: note: directive argument in the range [-2147483643, 2147483646]
> >       171 |                 sprintf(pbat->name, "PMU_battery_%d", i);
> >           |                                     ^~~~~~~~~~~~~~~~
> >     drivers/power/supply/pmu_battery.c:171:17: note: 'sprintf' output between 14 and 24 bytes into a destination of size 16
> >       171 |                 sprintf(pbat->name, "PMU_battery_%d", i);
> >           |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > 
> > 
> > vim +171 drivers/power/supply/pmu_battery.c
> > 
> > efea58e397dec8 drivers/power/pmu_battery.c David Woodhouse     2007-05-04  145
> > efea58e397dec8 drivers/power/pmu_battery.c David Woodhouse     2007-05-04  146  static int __init pmu_bat_init(void)
> > efea58e397dec8 drivers/power/pmu_battery.c David Woodhouse     2007-05-04  147  {
> > 297d716f6260cc drivers/power/pmu_battery.c Krzysztof Kozlowski 2015-03-12  148  	int ret = 0;
> > efea58e397dec8 drivers/power/pmu_battery.c David Woodhouse     2007-05-04  149  	int i;
> > efea58e397dec8 drivers/power/pmu_battery.c David Woodhouse     2007-05-04  150
> > efea58e397dec8 drivers/power/pmu_battery.c David Woodhouse     2007-05-04  151  	bat_pdev = platform_device_register_simple("pmu-battery",
> > efea58e397dec8 drivers/power/pmu_battery.c David Woodhouse     2007-05-04  152  						   0, NULL, 0);
> > efea58e397dec8 drivers/power/pmu_battery.c David Woodhouse     2007-05-04  153  	if (IS_ERR(bat_pdev)) {
> > efea58e397dec8 drivers/power/pmu_battery.c David Woodhouse     2007-05-04  154  		ret = PTR_ERR(bat_pdev);
> > efea58e397dec8 drivers/power/pmu_battery.c David Woodhouse     2007-05-04  155  		goto pdev_register_failed;
> > efea58e397dec8 drivers/power/pmu_battery.c David Woodhouse     2007-05-04  156  	}
> > efea58e397dec8 drivers/power/pmu_battery.c David Woodhouse     2007-05-04  157
> > 297d716f6260cc drivers/power/pmu_battery.c Krzysztof Kozlowski 2015-03-12  158  	pmu_ac = power_supply_register(&bat_pdev->dev, &pmu_ac_desc, NULL);
> > 297d716f6260cc drivers/power/pmu_battery.c Krzysztof Kozlowski 2015-03-12  159  	if (IS_ERR(pmu_ac)) {
> > 297d716f6260cc drivers/power/pmu_battery.c Krzysztof Kozlowski 2015-03-12  160  		ret = PTR_ERR(pmu_ac);
> > efea58e397dec8 drivers/power/pmu_battery.c David Woodhouse     2007-05-04  161  		goto ac_register_failed;
> > 297d716f6260cc drivers/power/pmu_battery.c Krzysztof Kozlowski 2015-03-12  162  	}
> > efea58e397dec8 drivers/power/pmu_battery.c David Woodhouse     2007-05-04  163
> > efea58e397dec8 drivers/power/pmu_battery.c David Woodhouse     2007-05-04  164  	for (i = 0; i < pmu_battery_count; i++) {
> > 297d716f6260cc drivers/power/pmu_battery.c Krzysztof Kozlowski 2015-03-12  165  		struct power_supply_config psy_cfg = {};
> > efea58e397dec8 drivers/power/pmu_battery.c David Woodhouse     2007-05-04  166  		struct pmu_battery_dev *pbat = kzalloc(sizeof(*pbat),
> > efea58e397dec8 drivers/power/pmu_battery.c David Woodhouse     2007-05-04  167  						       GFP_KERNEL);
> > efea58e397dec8 drivers/power/pmu_battery.c David Woodhouse     2007-05-04  168  		if (!pbat)
> > efea58e397dec8 drivers/power/pmu_battery.c David Woodhouse     2007-05-04  169  			break;
> > efea58e397dec8 drivers/power/pmu_battery.c David Woodhouse     2007-05-04  170
> > 35bf559145b633 drivers/power/pmu_battery.c Christian Kujau     2008-05-02 @171  		sprintf(pbat->name, "PMU_battery_%d", i);
> > 297d716f6260cc drivers/power/pmu_battery.c Krzysztof Kozlowski 2015-03-12  172  		pbat->bat_desc.name = pbat->name;
> > 297d716f6260cc drivers/power/pmu_battery.c Krzysztof Kozlowski 2015-03-12  173  		pbat->bat_desc.properties = pmu_bat_props;
> > 297d716f6260cc drivers/power/pmu_battery.c Krzysztof Kozlowski 2015-03-12  174  		pbat->bat_desc.num_properties = ARRAY_SIZE(pmu_bat_props);
> > 297d716f6260cc drivers/power/pmu_battery.c Krzysztof Kozlowski 2015-03-12  175  		pbat->bat_desc.get_property = pmu_bat_get_property;
> > efea58e397dec8 drivers/power/pmu_battery.c David Woodhouse     2007-05-04  176  		pbat->pbi = &pmu_batteries[i];
> > 297d716f6260cc drivers/power/pmu_battery.c Krzysztof Kozlowski 2015-03-12  177  		psy_cfg.drv_data = pbat;
> > efea58e397dec8 drivers/power/pmu_battery.c David Woodhouse     2007-05-04  178
> > 297d716f6260cc drivers/power/pmu_battery.c Krzysztof Kozlowski 2015-03-12  179  		pbat->bat = power_supply_register(&bat_pdev->dev,
> > 297d716f6260cc drivers/power/pmu_battery.c Krzysztof Kozlowski 2015-03-12  180  						  &pbat->bat_desc,
> > 297d716f6260cc drivers/power/pmu_battery.c Krzysztof Kozlowski 2015-03-12  181  						  &psy_cfg);
> > 297d716f6260cc drivers/power/pmu_battery.c Krzysztof Kozlowski 2015-03-12  182  		if (IS_ERR(pbat->bat)) {
> > 297d716f6260cc drivers/power/pmu_battery.c Krzysztof Kozlowski 2015-03-12  183  			ret = PTR_ERR(pbat->bat);
> > efea58e397dec8 drivers/power/pmu_battery.c David Woodhouse     2007-05-04  184  			kfree(pbat);
> > efea58e397dec8 drivers/power/pmu_battery.c David Woodhouse     2007-05-04  185  			goto battery_register_failed;
> > efea58e397dec8 drivers/power/pmu_battery.c David Woodhouse     2007-05-04  186  		}
> > efea58e397dec8 drivers/power/pmu_battery.c David Woodhouse     2007-05-04  187  		pbats[i] = pbat;
> > efea58e397dec8 drivers/power/pmu_battery.c David Woodhouse     2007-05-04  188  	}
> > efea58e397dec8 drivers/power/pmu_battery.c David Woodhouse     2007-05-04  189
> > efea58e397dec8 drivers/power/pmu_battery.c David Woodhouse     2007-05-04  190  	goto success;
> > efea58e397dec8 drivers/power/pmu_battery.c David Woodhouse     2007-05-04  191
> > efea58e397dec8 drivers/power/pmu_battery.c David Woodhouse     2007-05-04  192  battery_register_failed:
> > efea58e397dec8 drivers/power/pmu_battery.c David Woodhouse     2007-05-04  193  	while (i--) {
> > efea58e397dec8 drivers/power/pmu_battery.c David Woodhouse     2007-05-04  194  		if (!pbats[i])
> > efea58e397dec8 drivers/power/pmu_battery.c David Woodhouse     2007-05-04  195  			continue;
> > 297d716f6260cc drivers/power/pmu_battery.c Krzysztof Kozlowski 2015-03-12  196  		power_supply_unregister(pbats[i]->bat);
> > efea58e397dec8 drivers/power/pmu_battery.c David Woodhouse     2007-05-04  197  		kfree(pbats[i]);
> > efea58e397dec8 drivers/power/pmu_battery.c David Woodhouse     2007-05-04  198  	}
> > 297d716f6260cc drivers/power/pmu_battery.c Krzysztof Kozlowski 2015-03-12  199  	power_supply_unregister(pmu_ac);
> > efea58e397dec8 drivers/power/pmu_battery.c David Woodhouse     2007-05-04  200  ac_register_failed:
> > efea58e397dec8 drivers/power/pmu_battery.c David Woodhouse     2007-05-04  201  	platform_device_unregister(bat_pdev);
> > efea58e397dec8 drivers/power/pmu_battery.c David Woodhouse     2007-05-04  202  pdev_register_failed:
> > efea58e397dec8 drivers/power/pmu_battery.c David Woodhouse     2007-05-04  203  success:
> > efea58e397dec8 drivers/power/pmu_battery.c David Woodhouse     2007-05-04  204  	return ret;
> > efea58e397dec8 drivers/power/pmu_battery.c David Woodhouse     2007-05-04  205  }
> > efea58e397dec8 drivers/power/pmu_battery.c David Woodhouse     2007-05-04  206
> > 
> > :::::: The code at line 171 was first introduced by commit
> > :::::: 35bf559145b6332f5465c15a4e5cd7a363985382 PMU battery: filenames in sysfs with spaces
> > 
> > :::::: TO: Christian Kujau <lists@nerdbynature.de>
> > :::::: CC: Anton Vorontsov <cbouatmailru@gmail.com>
> > 

      reply	other threads:[~2023-11-13  6:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-09 17:27 drivers/power/supply/pmu_battery.c:171:50: warning: '%d' directive writing between 1 and 11 bytes into a region of size 4 kernel test robot
2023-11-09 18:23 ` Christophe Leroy
2023-11-13  6:32   ` Yujie Liu [this message]

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=ZVHDF2yzthb0D0SS@yujie-X299 \
    --to=yujie.liu@intel.com \
    --cc=christophe.leroy@csgroup.eu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=mpe@ellerman.id.au \
    --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.