public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Markus Koch <markus@notsyncing.net>
Cc: oe-kbuild-all@lists.linux.dev, linux-kernel@vger.kernel.org,
	Dmitry Torokhov <dmitry.torokhov@gmail.com>
Subject: drivers/input/joystick/fsia6b.c:152:57: warning: '/input0' directive output may be truncated writing 7 bytes into a region of size between 1 and 32
Date: Thu, 2 Jan 2025 03:24:26 +0800	[thread overview]
Message-ID: <202501020303.1WtxWWTu-lkp@intel.com> (raw)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   ccb98ccef0e543c2bd4ef1a72270461957f3d8d0
commit: 5d4b45a1dd7b00feab57624035dcdbc1bab2e0f8 Input: add support for the FlySky FS-iA6B RC receiver
date:   5 years ago
config: x86_64-randconfig-a013-20211029 (https://download.01.org/0day-ci/archive/20250102/202501020303.1WtxWWTu-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/20250102/202501020303.1WtxWWTu-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/202501020303.1WtxWWTu-lkp@intel.com/

All warnings (new ones prefixed by >>):

   drivers/input/joystick/fsia6b.c: In function 'fsia6b_serio_connect':
>> drivers/input/joystick/fsia6b.c:152:57: warning: '/input0' directive output may be truncated writing 7 bytes into a region of size between 1 and 32 [-Wformat-truncation=]
     152 |         snprintf(fsia6b->phys, sizeof(fsia6b->phys), "%s/input0", serio->phys);
         |                                                         ^~~~~~~
   drivers/input/joystick/fsia6b.c:152:9: note: 'snprintf' output between 8 and 39 bytes into a destination of size 32
     152 |         snprintf(fsia6b->phys, sizeof(fsia6b->phys), "%s/input0", serio->phys);
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


vim +152 drivers/input/joystick/fsia6b.c

   126	
   127	static int fsia6b_serio_connect(struct serio *serio, struct serio_driver *drv)
   128	{
   129		struct fsia6b *fsia6b;
   130		struct input_dev *input_dev;
   131		int err;
   132		int i, j;
   133		int sw_id = 0;
   134	
   135		fsia6b = kzalloc(sizeof(*fsia6b), GFP_KERNEL);
   136		if (!fsia6b)
   137			return -ENOMEM;
   138	
   139		fsia6b->packet.ibuf = 0;
   140		fsia6b->packet.offset = 0;
   141		fsia6b->packet.state = SYNC;
   142	
   143		serio_set_drvdata(serio, fsia6b);
   144	
   145		input_dev = input_allocate_device();
   146		if (!input_dev) {
   147			err = -ENOMEM;
   148			goto fail1;
   149		}
   150		fsia6b->dev = input_dev;
   151	
 > 152		snprintf(fsia6b->phys, sizeof(fsia6b->phys), "%s/input0", serio->phys);
   153	
   154		input_dev->name = DRIVER_DESC;
   155		input_dev->phys = fsia6b->phys;
   156		input_dev->id.bustype = BUS_RS232;
   157		input_dev->id.vendor = SERIO_FSIA6B;
   158		input_dev->id.product = serio->id.id;
   159		input_dev->id.version = 0x0100;
   160		input_dev->dev.parent = &serio->dev;
   161	
   162		for (i = 0; i < IBUS_SERVO_COUNT; i++)
   163			input_set_abs_params(input_dev, fsia6b_axes[i],
   164					     1000, 2000, 2, 2);
   165	
   166		/* Register switch configuration */
   167		for (i = 0; i < IBUS_SERVO_COUNT; i++) {
   168			if (switch_config[i] < '0' || switch_config[i] > '3') {
   169				dev_err(&fsia6b->dev->dev,
   170					"Invalid switch configuration supplied for fsia6b.\n");
   171				err = -EINVAL;
   172				goto fail2;
   173			}
   174	
   175			for (j = '1'; j <= switch_config[i]; j++) {
   176				input_set_capability(input_dev, EV_KEY, BTN_0 + sw_id);
   177				sw_id++;
   178			}
   179		}
   180	
   181		err = serio_open(serio, drv);
   182		if (err)
   183			goto fail2;
   184	
   185		err = input_register_device(fsia6b->dev);
   186		if (err)
   187			goto fail3;
   188	
   189		return 0;
   190	

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

                 reply	other threads:[~2025-01-01 19:25 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=202501020303.1WtxWWTu-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=markus@notsyncing.net \
    --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