public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Cc: oe-kbuild-all@lists.linux.dev, linux-kernel@vger.kernel.org,
	Lyude Paul <lyude@redhat.com>
Subject: drivers/gpu/drm/nouveau/nouveau_backlight.c:54:69: warning: '%d' directive output may be truncated writing between 1 and 10 bytes into a region of size 3
Date: Tue, 5 Dec 2023 03:40:06 +0800	[thread overview]
Message-ID: <202312050324.0kv4PnfZ-lkp@intel.com> (raw)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   33cc938e65a98f1d29d0a18403dbbee050dcad9a
commit: ab244be47a8f111bc82496a8a20c907236e37f95 drm/nouveau: Fix a potential theorical leak in nouveau_get_backlight_name()
date:   1 year, 7 months ago
config: x86_64-buildonly-randconfig-005-20230918 (https://download.01.org/0day-ci/archive/20231205/202312050324.0kv4PnfZ-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231205/202312050324.0kv4PnfZ-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/202312050324.0kv4PnfZ-lkp@intel.com/

All warnings (new ones prefixed by >>):

   drivers/gpu/drm/nouveau/nouveau_backlight.c: In function 'nouveau_backlight_init':
>> drivers/gpu/drm/nouveau/nouveau_backlight.c:54:69: warning: '%d' directive output may be truncated writing between 1 and 10 bytes into a region of size 3 [-Wformat-truncation=]
      54 |                 snprintf(backlight_name, BL_NAME_SIZE, "nv_backlight%d", nb);
         |                                                                     ^~
   In function 'nouveau_get_backlight_name',
       inlined from 'nouveau_backlight_init' at drivers/gpu/drm/nouveau/nouveau_backlight.c:408:7:
   drivers/gpu/drm/nouveau/nouveau_backlight.c:54:56: note: directive argument in the range [1, 2147483647]
      54 |                 snprintf(backlight_name, BL_NAME_SIZE, "nv_backlight%d", nb);
         |                                                        ^~~~~~~~~~~~~~~~
   drivers/gpu/drm/nouveau/nouveau_backlight.c:54:17: note: 'snprintf' output between 14 and 23 bytes into a destination of size 15
      54 |                 snprintf(backlight_name, BL_NAME_SIZE, "nv_backlight%d", nb);
         |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


vim +54 drivers/gpu/drm/nouveau/nouveau_backlight.c

db1a0ae21461af Pierre Moreau      2016-12-08  44  
db1a0ae21461af Pierre Moreau      2016-12-08  45  static bool
6d757753cef8d5 Lyude Paul         2018-09-06  46  nouveau_get_backlight_name(char backlight_name[BL_NAME_SIZE],
6d757753cef8d5 Lyude Paul         2018-09-06  47  			   struct nouveau_backlight *bl)
db1a0ae21461af Pierre Moreau      2016-12-08  48  {
ab244be47a8f11 Christophe JAILLET 2022-02-09  49  	const int nb = ida_alloc_max(&bl_ida, 99, GFP_KERNEL);
ab244be47a8f11 Christophe JAILLET 2022-02-09  50  
ab244be47a8f11 Christophe JAILLET 2022-02-09  51  	if (nb < 0)
db1a0ae21461af Pierre Moreau      2016-12-08  52  		return false;
db1a0ae21461af Pierre Moreau      2016-12-08  53  	if (nb > 0)
db1a0ae21461af Pierre Moreau      2016-12-08 @54  		snprintf(backlight_name, BL_NAME_SIZE, "nv_backlight%d", nb);
db1a0ae21461af Pierre Moreau      2016-12-08  55  	else
db1a0ae21461af Pierre Moreau      2016-12-08  56  		snprintf(backlight_name, BL_NAME_SIZE, "nv_backlight");
6d757753cef8d5 Lyude Paul         2018-09-06  57  	bl->id = nb;
db1a0ae21461af Pierre Moreau      2016-12-08  58  	return true;
db1a0ae21461af Pierre Moreau      2016-12-08  59  }
db1a0ae21461af Pierre Moreau      2016-12-08  60  

:::::: The code at line 54 was first introduced by commit
:::::: db1a0ae21461afa4bc435651a6dd55e0e6ef4a8b drm/nouveau/bl: Assign different names to interfaces

:::::: TO: Pierre Moreau <pierre.morrow@free.fr>
:::::: CC: Ben Skeggs <bskeggs@redhat.com>

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

             reply	other threads:[~2023-12-04 19:41 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-04 19:40 kernel test robot [this message]
  -- strict thread matches above, loose matches on Subject: below --
2025-01-08  3:03 drivers/gpu/drm/nouveau/nouveau_backlight.c:54:69: warning: '%d' directive output may be truncated writing between 1 and 10 bytes into a region of size 3 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=202312050324.0kv4PnfZ-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=christophe.jaillet@wanadoo.fr \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lyude@redhat.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox