lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202312031600.vNmAvMAC-lkp@intel.com>
Date:   Sun, 3 Dec 2023 16:35:01 +0800
From:   kernel test robot <lkp@...el.com>
To:     Yoshihiro Shimoda <yoshihiro.shimoda.uh@...esas.com>
Cc:     oe-kbuild-all@...ts.linux.dev, linux-kernel@...r.kernel.org,
        Felipe Balbi <balbi@...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

Hi Yoshihiro,

FYI, the error/warning still remains.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   968f35f4ab1c0966ceb39af3c89f2e24afedf878
commit: 746bfe63bba37ad55956b7377c9af494e7e28929 usb: gadget: renesas_usb3: add support for Renesas USB3.0 peripheral controller
date:   8 years ago
config: x86_64-buildonly-randconfig-006-20230906 (https://download.01.org/0day-ci/archive/20231203/202312031600.vNmAvMAC-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/20231203/202312031600.vNmAvMAC-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/202312031600.vNmAvMAC-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: 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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ