[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202501130717.VptPQT0W-lkp@intel.com>
Date: Mon, 13 Jan 2025 07:27:30 +0800
From: kernel test robot <lkp@...el.com>
To: Jason Gerecke <jason.gerecke@...om.com>
Cc: oe-kbuild-all@...ts.linux.dev, linux-kernel@...r.kernel.org,
Dmitry Torokhov <dmitry.torokhov@...il.com>
Subject: drivers/input/touchscreen/wacom_w8001.c:637:29: warning: ' Pen'
directive output may be truncated writing 4 bytes into a region of size
between 1 and 64
Hi Jason,
FYI, the error/warning still remains.
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: be548645527a131a097fdc884b7fca40c8b86231
commit: 6c7cc1a29d1e679be4a98b01141f1ba491e5775e Input: wacom_w8001 - simplify device name generation
date: 8 months ago
config: sparc-randconfig-002-20241212 (https://download.01.org/0day-ci/archive/20250113/202501130717.VptPQT0W-lkp@intel.com/config)
compiler: sparc64-linux-gcc (GCC) 12.4.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250113/202501130717.VptPQT0W-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/202501130717.VptPQT0W-lkp@intel.com/
All warnings (new ones prefixed by >>):
drivers/input/touchscreen/wacom_w8001.c: In function 'w8001_connect':
>> drivers/input/touchscreen/wacom_w8001.c:637:29: warning: ' Pen' directive output may be truncated writing 4 bytes into a region of size between 1 and 64 [-Wformat-truncation=]
637 | "%s Pen", basename);
| ^~~~
drivers/input/touchscreen/wacom_w8001.c:636:17: note: 'snprintf' output between 5 and 68 bytes into a destination of size 64
636 | snprintf(w8001->pen_name, sizeof(w8001->pen_name),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
637 | "%s Pen", basename);
| ~~~~~~~~~~~~~~~~~~~
>> drivers/input/touchscreen/wacom_w8001.c:653:29: warning: ' Finger' directive output may be truncated writing 7 bytes into a region of size between 1 and 64 [-Wformat-truncation=]
653 | "%s Finger", basename);
| ^~~~~~~
drivers/input/touchscreen/wacom_w8001.c:652:17: note: 'snprintf' output between 8 and 71 bytes into a destination of size 64
652 | snprintf(w8001->pen_name, sizeof(w8001->pen_name),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
653 | "%s Finger", basename);
| ~~~~~~~~~~~~~~~~~~~~~~
vim +637 drivers/input/touchscreen/wacom_w8001.c
586
587 /*
588 * w8001_connect() is the routine that is called when someone adds a
589 * new serio device that supports the w8001 protocol and registers it as
590 * an input device.
591 */
592
593 static int w8001_connect(struct serio *serio, struct serio_driver *drv)
594 {
595 struct w8001 *w8001;
596 struct input_dev *input_dev_pen;
597 struct input_dev *input_dev_touch;
598 char basename[64] = "Wacom Serial";
599 int err, err_pen, err_touch;
600
601 w8001 = kzalloc(sizeof(struct w8001), GFP_KERNEL);
602 input_dev_pen = input_allocate_device();
603 input_dev_touch = input_allocate_device();
604 if (!w8001 || !input_dev_pen || !input_dev_touch) {
605 err = -ENOMEM;
606 goto fail1;
607 }
608
609 w8001->serio = serio;
610 w8001->pen_dev = input_dev_pen;
611 w8001->touch_dev = input_dev_touch;
612 mutex_init(&w8001->mutex);
613 init_completion(&w8001->cmd_done);
614 snprintf(w8001->phys, sizeof(w8001->phys), "%s/input0", serio->phys);
615
616 serio_set_drvdata(serio, w8001);
617 err = serio_open(serio, drv);
618 if (err)
619 goto fail2;
620
621 err = w8001_detect(w8001);
622 if (err)
623 goto fail3;
624
625 /* For backwards-compatibility we compose the basename based on
626 * capabilities and then just append the tool type
627 */
628 err_pen = w8001_setup_pen(w8001, basename, sizeof(basename));
629 err_touch = w8001_setup_touch(w8001, basename, sizeof(basename));
630 if (err_pen && err_touch) {
631 err = -ENXIO;
632 goto fail3;
633 }
634
635 if (!err_pen) {
636 snprintf(w8001->pen_name, sizeof(w8001->pen_name),
> 637 "%s Pen", basename);
638 input_dev_pen->name = w8001->pen_name;
639
640 w8001_set_devdata(input_dev_pen, w8001, serio);
641
642 err = input_register_device(w8001->pen_dev);
643 if (err)
644 goto fail3;
645 } else {
646 input_free_device(input_dev_pen);
647 input_dev_pen = NULL;
648 w8001->pen_dev = NULL;
649 }
650
651 if (!err_touch) {
652 snprintf(w8001->pen_name, sizeof(w8001->pen_name),
> 653 "%s Finger", basename);
654 input_dev_touch->name = w8001->touch_name;
655
656 w8001_set_devdata(input_dev_touch, w8001, serio);
657
658 err = input_register_device(w8001->touch_dev);
659 if (err)
660 goto fail4;
661 } else {
662 input_free_device(input_dev_touch);
663 input_dev_touch = NULL;
664 w8001->touch_dev = NULL;
665 }
666
667 return 0;
668
669 fail4:
670 if (w8001->pen_dev)
671 input_unregister_device(w8001->pen_dev);
672 fail3:
673 serio_close(serio);
674 fail2:
675 serio_set_drvdata(serio, NULL);
676 fail1:
677 input_free_device(input_dev_pen);
678 input_free_device(input_dev_touch);
679 kfree(w8001);
680 return err;
681 }
682
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
Powered by blists - more mailing lists