All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Cc: oe-kbuild-all@lists.linux.dev, linux-kernel@vger.kernel.org,
	Felipe Balbi <balbi@ti.com>
Subject: drivers/usb/gadget/udc/renesas_usb3.c:1797:73: warning: '%d' directive output may be truncated writing between 1 and 10 bytes into a region of size 6
Date: Tue, 7 Nov 2023 03:04:37 +0800	[thread overview]
Message-ID: <202311070258.WXmAZXKE-lkp@intel.com> (raw)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   d2f51b3516dade79269ff45eae2a7668ae711b25
commit: 746bfe63bba37ad55956b7377c9af494e7e28929 usb: gadget: renesas_usb3: add support for Renesas USB3.0 peripheral controller
date:   8 years ago
config: x86_64-buildonly-randconfig-006-20230830 (https://download.01.org/0day-ci/archive/20231107/202311070258.WXmAZXKE-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/20231107/202311070258.WXmAZXKE-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/202311070258.WXmAZXKE-lkp@intel.com/

All warnings (new ones prefixed by >>):

   In file included from include/linux/kobject.h:21,
                    from include/linux/module.h:17,
                    from drivers/usb/gadget/udc/renesas_usb3.c:15:
   include/linux/sysfs.h: In function 'sysfs_get_dirent':
   include/linux/sysfs.h:517:44: warning: pointer targets in passing argument 2 of 'kernfs_find_and_get' differ in signedness [-Wpointer-sign]
     517 |         return kernfs_find_and_get(parent, name);
         |                                            ^~~~
         |                                            |
         |                                            const unsigned char *
   In file included from include/linux/sysfs.h:15:
   include/linux/kernfs.h:428:57: note: expected 'const char *' but argument is of type 'const unsigned char *'
     428 | kernfs_find_and_get(struct kernfs_node *kn, const char *name)
         |                                             ~~~~~~~~~~~~^~~~
   drivers/usb/gadget/udc/renesas_usb3.c: In function 'usb3_get_setup_data':
   drivers/usb/gadget/udc/renesas_usb3.c:718:9: warning: converting a packed 'struct usb_ctrlrequest' pointer (alignment 1) to a 'u32' {aka 'unsigned int'} pointer (alignment 4) may result in an unaligned pointer value [-Waddress-of-packed-member]
     718 |         u32 *data = (u32 *)ctrl;
         |         ^~~
   In file included from include/linux/usb/ch9.h:36,
                    from drivers/usb/gadget/udc/renesas_usb3.c:21:
   include/uapi/linux/usb/ch9.h:185:8: note: defined here
     185 | struct usb_ctrlrequest {
         |        ^~~~~~~~~~~~~~~
   drivers/usb/gadget/udc/renesas_usb3.c: At top level:
   include/linux/module.h:136:14: warning: 'cleanup_module' specifies less restrictive attribute than its target 'renesas_usb3_driver_exit': 'cold' [-Wmissing-attributes]
     136 |         void cleanup_module(void) __attribute__((alias(#exitfn)));
         |              ^~~~~~~~~~~~~~
   include/linux/device.h:1334:1: note: in expansion of macro 'module_exit'
    1334 | module_exit(__driver##_exit);
         | ^~~~~~~~~~~
   include/linux/platform_device.h:222:9: note: in expansion of macro 'module_driver'
     222 |         module_driver(__platform_driver, platform_driver_register, \
         |         ^~~~~~~~~~~~~
   drivers/usb/gadget/udc/renesas_usb3.c:1970:1: note: in expansion of macro 'module_platform_driver'
    1970 | module_platform_driver(renesas_usb3_driver);
         | ^~~~~~~~~~~~~~~~~~~~~~
   In file included from include/linux/node.h:17,
                    from include/linux/cpu.h:16,
                    from include/linux/of_device.h:4,
                    from drivers/usb/gadget/udc/renesas_usb3.c:16:
   drivers/usb/gadget/udc/renesas_usb3.c:1970:24: note: 'cleanup_module' target declared here
    1970 | module_platform_driver(renesas_usb3_driver);
         |                        ^~~~~~~~~~~~~~~~~~~
   include/linux/device.h:1330:20: note: in definition of macro 'module_driver'
    1330 | static void __exit __driver##_exit(void) \
         |                    ^~~~~~~~
   drivers/usb/gadget/udc/renesas_usb3.c:1970:1: note: in expansion of macro 'module_platform_driver'
    1970 | module_platform_driver(renesas_usb3_driver);
         | ^~~~~~~~~~~~~~~~~~~~~~
   include/linux/module.h:130:13: warning: 'init_module' specifies less restrictive attribute than its target 'renesas_usb3_driver_init': 'cold' [-Wmissing-attributes]
     130 |         int init_module(void) __attribute__((alias(#initfn)));
         |             ^~~~~~~~~~~
   include/linux/device.h:1329:1: note: in expansion of macro 'module_init'
    1329 | module_init(__driver##_init); \
         | ^~~~~~~~~~~
   include/linux/platform_device.h:222:9: note: in expansion of macro 'module_driver'
     222 |         module_driver(__platform_driver, platform_driver_register, \
         |         ^~~~~~~~~~~~~
   drivers/usb/gadget/udc/renesas_usb3.c:1970:1: note: in expansion of macro 'module_platform_driver'
    1970 | module_platform_driver(renesas_usb3_driver);
         | ^~~~~~~~~~~~~~~~~~~~~~
   drivers/usb/gadget/udc/renesas_usb3.c:1970:24: note: 'init_module' target declared here
    1970 | module_platform_driver(renesas_usb3_driver);
         |                        ^~~~~~~~~~~~~~~~~~~
   include/linux/device.h:1325:19: note: in definition of macro 'module_driver'
    1325 | static int __init __driver##_init(void) \
         |                   ^~~~~~~~
   drivers/usb/gadget/udc/renesas_usb3.c:1970:1: note: in expansion of macro 'module_platform_driver'
    1970 | module_platform_driver(renesas_usb3_driver);
         | ^~~~~~~~~~~~~~~~~~~~~~
   drivers/usb/gadget/udc/renesas_usb3.c: In function 'renesas_usb3_probe':
>> drivers/usb/gadget/udc/renesas_usb3.c:1797:73: warning: '%d' directive output may be truncated writing between 1 and 10 bytes into a region of size 6 [-Wformat-truncation=]
    1797 |                 snprintf(usb3_ep->ep_name, sizeof(usb3_ep->ep_name), "ep%d", i);
         |                                                                         ^~
   In function 'renesas_usb3_init_ep',
       inlined from 'renesas_usb3_probe' at drivers/usb/gadget/udc/renesas_usb3.c:1928:8:
   drivers/usb/gadget/udc/renesas_usb3.c:1797:70: note: directive argument in the range [0, 2147483646]
    1797 |                 snprintf(usb3_ep->ep_name, sizeof(usb3_ep->ep_name), "ep%d", i);
         |                                                                      ^~~~~~
   drivers/usb/gadget/udc/renesas_usb3.c:1797:17: note: 'snprintf' output between 4 and 13 bytes into a destination of size 8
    1797 |                 snprintf(usb3_ep->ep_name, sizeof(usb3_ep->ep_name), "ep%d", i);
         |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


vim +1797 drivers/usb/gadget/udc/renesas_usb3.c

  1771	
  1772	static int renesas_usb3_init_ep(struct renesas_usb3 *usb3, struct device *dev,
  1773					const struct renesas_usb3_priv *priv)
  1774	{
  1775		struct renesas_usb3_ep *usb3_ep;
  1776		int i;
  1777	
  1778		/* calculate num_usb3_eps from renesas_usb3_priv */
  1779		usb3->num_usb3_eps = priv->ramsize_per_ramif * priv->num_ramif * 2 /
  1780				     priv->ramsize_per_pipe + 1;
  1781	
  1782		if (usb3->num_usb3_eps > USB3_MAX_NUM_PIPES)
  1783			usb3->num_usb3_eps = USB3_MAX_NUM_PIPES;
  1784	
  1785		usb3->usb3_ep = devm_kzalloc(dev, sizeof(*usb3_ep) * usb3->num_usb3_eps,
  1786					     GFP_KERNEL);
  1787		if (!usb3->usb3_ep)
  1788			return -ENOMEM;
  1789	
  1790		dev_dbg(dev, "%s: num_usb3_eps = %d\n", __func__, usb3->num_usb3_eps);
  1791		/*
  1792		 * This driver prepares pipes as the followings:
  1793		 *  - odd pipes = IN pipe
  1794		 *  - even pipes = OUT pipe (except pipe 0)
  1795		 */
  1796		usb3_for_each_ep(usb3_ep, usb3, i) {
> 1797			snprintf(usb3_ep->ep_name, sizeof(usb3_ep->ep_name), "ep%d", i);
  1798			usb3_ep->usb3 = usb3;
  1799			usb3_ep->num = i;
  1800			usb3_ep->ep.name = usb3_ep->ep_name;
  1801			usb3_ep->ep.ops = &renesas_usb3_ep_ops;
  1802			INIT_LIST_HEAD(&usb3_ep->queue);
  1803			INIT_LIST_HEAD(&usb3_ep->ep.ep_list);
  1804			if (!i) {
  1805				/* for control pipe */
  1806				usb3->gadget.ep0 = &usb3_ep->ep;
  1807				usb_ep_set_maxpacket_limit(&usb3_ep->ep,
  1808							USB3_EP0_HSFS_MAX_PACKET_SIZE);
  1809				usb3_ep->ep.caps.type_control = true;
  1810				usb3_ep->ep.caps.dir_in = true;
  1811				usb3_ep->ep.caps.dir_out = true;
  1812				continue;
  1813			}
  1814	
  1815			/* for bulk or interrupt pipe */
  1816			usb_ep_set_maxpacket_limit(&usb3_ep->ep, ~0);
  1817			list_add_tail(&usb3_ep->ep.ep_list, &usb3->gadget.ep_list);
  1818			usb3_ep->ep.caps.type_bulk = true;
  1819			usb3_ep->ep.caps.type_int = true;
  1820			if (i & 1)
  1821				usb3_ep->ep.caps.dir_in = true;
  1822			else
  1823				usb3_ep->ep.caps.dir_out = true;
  1824		}
  1825	
  1826		return 0;
  1827	}
  1828	

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

             reply	other threads:[~2023-11-06 19:05 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-06 19:04 kernel test robot [this message]
  -- strict thread matches above, loose matches on Subject: below --
2023-12-03  8:35 drivers/usb/gadget/udc/renesas_usb3.c:1797:73: warning: '%d' directive output may be truncated writing between 1 and 10 bytes into a region of size 6 kernel test robot

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=202311070258.WXmAZXKE-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=balbi@ti.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=yoshihiro.shimoda.uh@renesas.com \
    /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.