All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Neill Kapron <nkapron@google.com>
Cc: oe-kbuild-all@lists.linux.dev, linux-usb@vger.kernel.org,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>
Subject: [usb:usb-testing 33/66] 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
Date: Sat, 11 Jul 2026 10:14:37 +0800	[thread overview]
Message-ID: <202607111052.PRRGX3Jq-lkp@intel.com> (raw)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing
head:   1db5c6b0b9834aee2f14e39764becfcc29d09ccf
commit: 0f0ea552cd215a01baca1e99eec02e2f8df0c897 [33/66] usb: gadget: f_fs: Introduce rw_proxy file descriptors
config: s390-randconfig-002-20260711 (https://download.01.org/0day-ci/archive/20260711/202607111052.PRRGX3Jq-lkp@intel.com/config)
compiler: s390-linux-gcc (GCC) 8.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260711/202607111052.PRRGX3Jq-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/202607111052.PRRGX3Jq-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

                 reply	other threads:[~2026-07-11  2:14 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=202607111052.PRRGX3Jq-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=nkapron@google.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.