Re: [PATCH] staging: vme_user: use scnprintf in tsi148_alloc_resource

From: kernel test robot

Date: Fri Oct 23 2026 - 22:26:43 EST


Hi LiuJunyuan,

kernel test robot noticed the following build warnings:

[auto build test WARNING on staging/staging-testing]

url: https://github.com/intel-lab-lkp/linux/commits/LiuJunyuan/staging-vme_user-use-scnprintf-in-tsi148_alloc_resource/20261021-111349
base: staging/staging-testing
patch link: https://lore.kernel.org/r/tencent_F5EEA06B3CD49F9EFF5C185259BF4134DA0A%40qq.com
patch subject: [PATCH] staging: vme_user: use scnprintf in tsi148_alloc_resource
config: i386-randconfig-1006-20261021 (https://download.01.org/0day-ci/archive/20261024/202610241010.ezQcs5lj-lkp@xxxxxxxxx/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20261024/202610241010.ezQcs5lj-lkp@xxxxxxxxx/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@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202610241010.ezQcs5lj-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

drivers/staging/vme_user/vme_tsi148.c: In function 'tsi148_alloc_resource':
>> drivers/staging/vme_user/vme_tsi148.c:748:38: warning: passing argument 1 of 'scnprintf' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
748 | scnprintf(image->bus_resource.name, VMENAMSIZ + 3, "%s.%d",
| ~~~~~~~~~~~~~~~~~~~^~~~~
In file included from include/linux/kernel.h:32,
from include/linux/random.h:7,
from include/linux/nodemask.h:94,
from include/linux/numa.h:6,
from include/linux/cpumask.h:15,
from arch/x86/include/asm/paravirt.h:19,
from arch/x86/include/asm/irqflags.h:100,
from include/linux/irqflags.h:18,
from arch/x86/include/asm/special_insns.h:10,
from arch/x86/include/asm/processor.h:25,
from arch/x86/include/asm/timex.h:5,
from include/linux/timex.h:67,
from include/linux/time32.h:13,
from include/linux/time.h:60,
from include/linux/stat.h:19,
from include/linux/module.h:13,
from drivers/staging/vme_user/vme_tsi148.c:12:
include/linux/sprintf.h:15:36: note: expected 'char *' but argument is of type 'const char *'
15 | __printf(3, 4) int scnprintf(char *buf, size_t size, const char *fmt, ...);
| ~~~~~~^~~


vim +748 drivers/staging/vme_user/vme_tsi148.c

705
706 /*
707 * Allocate and map PCI Resource
708 */
709 static int tsi148_alloc_resource(struct vme_master_resource *image,
710 unsigned long long size)
711 {
712 unsigned long long existing_size;
713 int retval = 0;
714 struct pci_dev *pdev;
715 struct vme_bridge *tsi148_bridge;
716
717 tsi148_bridge = image->parent;
718
719 pdev = to_pci_dev(tsi148_bridge->parent);
720
721 existing_size = (unsigned long long)(image->bus_resource.end -
722 image->bus_resource.start);
723
724 /* If the existing size is OK, return */
725 if ((size != 0) && (existing_size == (size - 1)))
726 return 0;
727
728 if (existing_size != 0) {
729 iounmap(image->kern_base);
730 image->kern_base = NULL;
731 kfree(image->bus_resource.name);
732 release_resource(&image->bus_resource);
733 memset(&image->bus_resource, 0, sizeof(image->bus_resource));
734 }
735
736 /* Exit here if size is zero */
737 if (size == 0)
738 return 0;
739
740 if (!image->bus_resource.name) {
741 image->bus_resource.name = kmalloc(VMENAMSIZ + 3, GFP_ATOMIC);
742 if (!image->bus_resource.name) {
743 retval = -ENOMEM;
744 goto err_name;
745 }
746 }
747
> 748 scnprintf(image->bus_resource.name, VMENAMSIZ + 3, "%s.%d",
749 tsi148_bridge->name, image->number);
750
751 image->bus_resource.start = 0;
752 image->bus_resource.end = (unsigned long)size;
753 image->bus_resource.flags = IORESOURCE_MEM;
754
755 retval = pci_bus_alloc_resource(pdev->bus, &image->bus_resource,
756 size, 0x10000, PCIBIOS_MIN_MEM,
757 0, NULL, NULL);
758 if (retval) {
759 dev_err(tsi148_bridge->parent, "Failed to allocate mem resource for window %d size 0x%lx start 0x%lx\n",
760 image->number, (unsigned long)size,
761 (unsigned long)image->bus_resource.start);
762 goto err_resource;
763 }
764
765 image->kern_base = ioremap(image->bus_resource.start, size);
766 if (!image->kern_base) {
767 dev_err(tsi148_bridge->parent, "Failed to remap resource\n");
768 retval = -ENOMEM;
769 goto err_remap;
770 }
771
772 return 0;
773
774 err_remap:
775 release_resource(&image->bus_resource);
776 err_resource:
777 kfree(image->bus_resource.name);
778 memset(&image->bus_resource, 0, sizeof(image->bus_resource));
779 err_name:
780 return retval;
781 }
782

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