public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild@lists.01.org, Rajnikant Bhojani <rajnikant.bhojani@xilinx.com>
Cc: Michal Simek <monstr@monstr.eu>,
	kbuild-all@lists.01.org, lkp@intel.com,
	Piyush Mehta <piyush.mehta@xilinx.com>,
	linux-arm-kernel@lists.infradead.org,
	Dan Carpenter <error27@gmail.com>
Subject: [xlnx:xlnx_rebase_v5.4 892/1683] drivers/usb/gadget/function/f_tcm.c:342 alloc_cmd_resource() warn: this array is probably non-NULL. 'fu->cmd'
Date: Fri, 30 Oct 2020 10:56:55 +0300	[thread overview]
Message-ID: <20201030075655.GB12347@kadam> (raw)

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

tree:   https://github.com/Xilinx/linux-xlnx xlnx_rebase_v5.4
head:   87d2d58e2137748748d96a630fd93eb0e2d81123
commit: 940136294318baeb0fa1e20b56243cd6a7b9c846 [892/1683] usb: gadget: f_tcm: queue multiple commands request
config: x86_64-randconfig-m001-20201029 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0

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

smatch warnings:
drivers/usb/gadget/function/f_tcm.c:342 alloc_cmd_resource() warn: this array is probably non-NULL. 'fu->cmd'

vim +342 drivers/usb/gadget/function/f_tcm.c

940136294318bae Rajnikant Bhojani 2020-01-23  332  static int alloc_cmd_resource(struct f_uas *fu, int num, struct usb_ep *ep,
940136294318bae Rajnikant Bhojani 2020-01-23  333  			      void  (*complete)(struct usb_ep *ep,
940136294318bae Rajnikant Bhojani 2020-01-23  334  						struct usb_request *req))
940136294318bae Rajnikant Bhojani 2020-01-23  335  {
940136294318bae Rajnikant Bhojani 2020-01-23  336  	int i;
940136294318bae Rajnikant Bhojani 2020-01-23  337  
940136294318bae Rajnikant Bhojani 2020-01-23  338  	fu->ncmd = num;
940136294318bae Rajnikant Bhojani 2020-01-23  339  	for (i = 0; i < fu->ncmd; i++) {
940136294318bae Rajnikant Bhojani 2020-01-23  340  		fu->cmd[i] = kcalloc(fu->ncmd, sizeof(struct usbg_cdb),
940136294318bae Rajnikant Bhojani 2020-01-23  341  				GFP_KERNEL);
940136294318bae Rajnikant Bhojani 2020-01-23 @342  		if (!fu->cmd)

This should be "if (!fu->cmd[i])"

940136294318bae Rajnikant Bhojani 2020-01-23  343  			goto err_cmd;
940136294318bae Rajnikant Bhojani 2020-01-23  344  
940136294318bae Rajnikant Bhojani 2020-01-23  345  		fu->cmd[i]->req = usb_ep_alloc_request(ep, GFP_KERNEL);
940136294318bae Rajnikant Bhojani 2020-01-23  346  		if (!fu->cmd[i]->req)
940136294318bae Rajnikant Bhojani 2020-01-23  347  			goto err_cmd;
940136294318bae Rajnikant Bhojani 2020-01-23  348  
940136294318bae Rajnikant Bhojani 2020-01-23  349  		fu->cmd[i]->buf = kmalloc(fu->ep_out->maxpacket, GFP_KERNEL);
940136294318bae Rajnikant Bhojani 2020-01-23  350  		if (!fu->cmd[i]->buf)
940136294318bae Rajnikant Bhojani 2020-01-23  351  			goto err_cmd;
940136294318bae Rajnikant Bhojani 2020-01-23  352  
940136294318bae Rajnikant Bhojani 2020-01-23  353  		fu->cmd[i]->req->complete = complete;
940136294318bae Rajnikant Bhojani 2020-01-23  354  		fu->cmd[i]->req->buf = fu->cmd[i]->buf;
940136294318bae Rajnikant Bhojani 2020-01-23  355  		fu->cmd[i]->req->length = fu->ep_out->maxpacket;
940136294318bae Rajnikant Bhojani 2020-01-23  356  		fu->cmd[i]->req->context = fu;
940136294318bae Rajnikant Bhojani 2020-01-23  357  	}
940136294318bae Rajnikant Bhojani 2020-01-23  358  
940136294318bae Rajnikant Bhojani 2020-01-23  359  	return 0;
940136294318bae Rajnikant Bhojani 2020-01-23  360  err_cmd:
940136294318bae Rajnikant Bhojani 2020-01-23  361  	free_cmd_resource(fu, ep);
940136294318bae Rajnikant Bhojani 2020-01-23  362  	return -ENOMEM;
940136294318bae Rajnikant Bhojani 2020-01-23  363  }

---
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: 32941 bytes --]

[-- Attachment #3: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

                 reply	other threads:[~2020-10-30  7:59 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=20201030075655.GB12347@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=error27@gmail.com \
    --cc=kbuild-all@lists.01.org \
    --cc=kbuild@lists.01.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=lkp@intel.com \
    --cc=monstr@monstr.eu \
    --cc=piyush.mehta@xilinx.com \
    --cc=rajnikant.bhojani@xilinx.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