linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Zhang Qilong <zhangqilong3@huawei.com>,
	balbi@kernel.org, gregkh@linuxfoundation.org
Cc: kbuild-all@lists.01.org, clang-built-linux@googlegroups.com,
	linux-usb@vger.kernel.org
Subject: Re: [PATCH 2/2] usb: gadget: Fix memleak in gadgetfs_fill_super
Date: Mon, 16 Nov 2020 23:06:07 +0800	[thread overview]
Message-ID: <202011162352.jjeevQG4-lkp@intel.com> (raw)
In-Reply-To: <20201116121710.1546690-3-zhangqilong3@huawei.com>

[-- Attachment #1: Type: text/plain, Size: 4000 bytes --]

Hi Zhang,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on balbi-usb/testing/next]
[also build test ERROR on usb/usb-testing linus/master peter.chen-usb/ci-for-usb-next v5.10-rc4 next-20201116]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Zhang-Qilong/usb-gadget-Fix-two-memleaks-in-error-handling/20201116-201612
base:   https://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git testing/next
config: powerpc-randconfig-r015-20201116 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project c044709b8fbea2a9a375e4173a6bd735f6866c0c)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install powerpc cross compiling tool for clang build
        # apt-get install binutils-powerpc-linux-gnu
        # https://github.com/0day-ci/linux/commit/0dfab8598cb8b814fc17011d7a15ff463840e1dd
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Zhang-Qilong/usb-gadget-Fix-two-memleaks-in-error-handling/20201116-201612
        git checkout 0dfab8598cb8b814fc17011d7a15ff463840e1dd
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=powerpc 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

>> drivers/usb/gadget/legacy/inode.c:2042:2: error: implicitly declaring library function 'free' with type 'void (void *)' [-Werror,-Wimplicit-function-declaration]
           free(CHIP);
           ^
   drivers/usb/gadget/legacy/inode.c:2042:2: note: include the header <stdlib.h> or explicitly provide a declaration for 'free'
>> drivers/usb/gadget/legacy/inode.c:2042:7: error: passing 'const char *' to parameter of type 'void *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
           free(CHIP);
                ^~~~
   2 errors generated.

vim +2042 drivers/usb/gadget/legacy/inode.c

  1990	
  1991	static int
  1992	gadgetfs_fill_super (struct super_block *sb, struct fs_context *fc)
  1993	{
  1994		struct inode	*inode;
  1995		struct dev_data	*dev;
  1996	
  1997		if (the_device)
  1998			return -ESRCH;
  1999	
  2000		CHIP = usb_get_gadget_udc_name();
  2001		if (!CHIP)
  2002			return -ENODEV;
  2003	
  2004		/* superblock */
  2005		sb->s_blocksize = PAGE_SIZE;
  2006		sb->s_blocksize_bits = PAGE_SHIFT;
  2007		sb->s_magic = GADGETFS_MAGIC;
  2008		sb->s_op = &gadget_fs_operations;
  2009		sb->s_time_gran = 1;
  2010	
  2011		/* root inode */
  2012		inode = gadgetfs_make_inode (sb,
  2013				NULL, &simple_dir_operations,
  2014				S_IFDIR | S_IRUGO | S_IXUGO);
  2015		if (!inode)
  2016			goto Enomem;
  2017		inode->i_op = &simple_dir_inode_operations;
  2018		if (!(sb->s_root = d_make_root (inode)))
  2019			goto Enomem;
  2020	
  2021		/* the ep0 file is named after the controller we expect;
  2022		 * user mode code can use it for sanity checks, like we do.
  2023		 */
  2024		dev = dev_new ();
  2025		if (!dev)
  2026			goto Enomem;
  2027	
  2028		dev->sb = sb;
  2029		dev->dentry = gadgetfs_create_file(sb, CHIP, dev, &ep0_operations);
  2030		if (!dev->dentry) {
  2031			put_dev(dev);
  2032			goto Enomem;
  2033		}
  2034	
  2035		/* other endpoint files are available after hardware setup,
  2036		 * from binding to a controller.
  2037		 */
  2038		the_device = dev;
  2039		return 0;
  2040	
  2041	Enomem:
> 2042		free(CHIP);
  2043		CHIP = NULL;
  2044	
  2045		return -ENOMEM;
  2046	}
  2047	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 33790 bytes --]

      parent reply	other threads:[~2020-11-16 15:07 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-16 12:17 [PATCH 0/2] usb: gadget: Fix two memleaks in error handling Zhang Qilong
2020-11-16 12:17 ` [PATCH 1/2] usb: gadget: f_midi: Fix memleak in f_midi_alloc Zhang Qilong
2020-11-16 12:59   ` Peter Chen
2020-11-16 16:12   ` Sergei Shtylyov
2020-11-16 12:17 ` [PATCH 2/2] usb: gadget: Fix memleak in gadgetfs_fill_super Zhang Qilong
2020-11-16 13:04   ` Peter Chen
2020-11-17  1:44     ` 答复: " zhangqilong
2020-11-16 15:06   ` kernel test robot [this message]

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=202011162352.jjeevQG4-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=balbi@kernel.org \
    --cc=clang-built-linux@googlegroups.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kbuild-all@lists.01.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=zhangqilong3@huawei.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).