mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* drivers/usb/gadget/function/f_fs.c:2428:48: warning: '_rw' directive output may be truncated writing 3 bytes into a region of size between 1 and 8
@ 2026-09-17  7:24 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2026-09-17  7:24 UTC (permalink / raw)
  To: Neill Kapron; +Cc: oe-kbuild-all, linux-kernel

Hi Neill,

FYI, the error/warning still remains.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   9b87fdc9af2fbfcdb5c24a64139685ef80f6573f
commit: 0f0ea552cd215a01baca1e99eec02e2f8df0c897 usb: gadget: f_fs: Introduce rw_proxy file descriptors
date:   10 weeks ago
config: arm64-randconfig-1000-20260917 (https://download.01.org/0day-ci/archive/20260917/202609171504.8fgEluKO-lkp@intel.com/config)
compiler: aarch64-linux-gcc (GCC) 8.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260917/202609171504.8fgEluKO-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
| Fixes: 0f0ea552cd21 ("usb: gadget: f_fs: Introduce rw_proxy file descriptors")
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202609171504.8fgEluKO-lkp@intel.com/

All warnings (new ones prefixed by >>):

   drivers/usb/gadget/function/f_fs.c: In function 'ffs_ep0_write':
>> drivers/usb/gadget/function/f_fs.c:2428:48: warning: '_rw' directive output may be truncated writing 3 bytes into a region of size between 1 and 8 [-Wformat-truncation=]
       snprintf(comp->name, sizeof(comp->name), "%s_rw",
                                                   ^~~
   drivers/usb/gadget/function/f_fs.c:2428:4: note: 'snprintf' output between 4 and 11 bytes into a destination of size 8
       snprintf(comp->name, sizeof(comp->name), "%s_rw",
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         epfiles[i].name);
         ~~~~~~~~~~~~~~~~


vim +/_rw +2428 drivers/usb/gadget/function/f_fs.c

  2378	
  2379	static int ffs_epfiles_create(struct ffs_data *ffs)
  2380	{
  2381		struct ffs_epfile *epfile, *epfiles;
  2382		unsigned int i, count, epfiles_count;
  2383		int err;
  2384	
  2385		count = ffs->eps_count;
  2386		epfiles_count = count;
  2387		if (ffs->user_flags & FUNCTIONFS_RW_PROXY_EPS)
  2388			epfiles_count += count / 2;
  2389		ffs->epfiles_count = epfiles_count;
  2390	
  2391		epfiles = kzalloc_objs(*epfiles, epfiles_count);
  2392		if (!epfiles)
  2393			return -ENOMEM;
  2394	
  2395		epfile = epfiles;
  2396		for (i = 1; i <= count; ++i, ++epfile) {
  2397			epfile->ffs = ffs;
  2398			mutex_init(&epfile->mutex);
  2399			mutex_init(&epfile->dmabufs_mutex);
  2400			INIT_LIST_HEAD(&epfile->dmabufs);
  2401			if (ffs->user_flags & FUNCTIONFS_VIRTUAL_ADDR)
  2402				sprintf(epfile->name, "ep%02x", ffs->eps_addrmap[i]);
  2403			else
  2404				sprintf(epfile->name, "ep%u", i);
  2405			err = ffs_sb_create_file(ffs->sb, epfile->name,
  2406						 epfile, &ffs_epfile_operations);
  2407			if (err) {
  2408				ffs_epfiles_destroy(ffs->sb, epfiles, i - 1);
  2409				return err;
  2410			}
  2411		}
  2412	
  2413		if (ffs->user_flags & FUNCTIONFS_RW_PROXY_EPS) {
  2414			struct ffs_epfile *comp = epfiles + count;
  2415	
  2416			for (i = 0; i < count; i += 2, ++comp) {
  2417				struct ffs_epfile *ep1 = &epfiles[i];
  2418				struct ffs_epfile *ep2 = &epfiles[i + 1];
  2419				bool ep1_in = ffs->eps_addrmap[i + 1] & USB_ENDPOINT_DIR_MASK;
  2420	
  2421				comp->ffs = ffs;
  2422				comp->is_rw_proxy = true;
  2423				comp->epfile_in = ep1_in ? ep1 : ep2;
  2424				comp->epfile_out = ep1_in ? ep2 : ep1;
  2425				mutex_init(&comp->mutex);
  2426				mutex_init(&comp->dmabufs_mutex);
  2427				INIT_LIST_HEAD(&comp->dmabufs);
> 2428				snprintf(comp->name, sizeof(comp->name), "%s_rw",
  2429					 epfiles[i].name);
  2430				err = ffs_sb_create_file(ffs->sb, comp->name,
  2431							 comp, &ffs_epfile_operations);
  2432				if (err) {
  2433					ffs_epfiles_destroy(ffs->sb, epfiles, count + (i / 2));
  2434					return err;
  2435				}
  2436			}
  2437		}
  2438	
  2439		ffs->epfiles = epfiles;
  2440		return 0;
  2441	}
  2442	

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-09-17  7:25 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-17  7:24 drivers/usb/gadget/function/f_fs.c:2428:48: warning: '_rw' directive output may be truncated writing 3 bytes into a region of size between 1 and 8 kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®