All of lore.kernel.org
 help / color / mirror / Atom feed
From: kbuild test robot <lkp@intel.com>
To: kbuild@lists.01.org
Subject: drivers/usb/gadget/legacy/raw_gadget.c:102 raw_event_queue_fetch() warn: inconsistent returns 'queue->sema'.
Date: Tue, 02 Jun 2020 14:08:08 +0800	[thread overview]
Message-ID: <202006021403.hj36Xerk%lkp@intel.com> (raw)

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

CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: "Andrey, Konovalov," <andreyknvl@google.com>
CC: Felipe Balbi <balbi@kernel.org>
CC: "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   f359287765c04711ff54fbd11645271d8e5ff763
commit: f2c2e717642c66f7fe7e5dd69b2e8ff5849f4d10 usb: gadget: add raw-gadget interface
date:   3 months ago
:::::: branch date: 6 hours ago
:::::: commit date: 3 months ago
config: x86_64-randconfig-m001-20200602 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-13) 9.3.0

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

New smatch warnings:
drivers/usb/gadget/legacy/raw_gadget.c:102 raw_event_queue_fetch() warn: inconsistent returns 'queue->sema'.

Old smatch warnings:
drivers/usb/gadget/legacy/raw_gadget.c:397 raw_ioctl_init() warn: maybe return -EFAULT instead of the bytes remaining?
drivers/usb/gadget/legacy/raw_gadget.c:512 raw_ioctl_event_fetch() warn: maybe return -EFAULT instead of the bytes remaining?
drivers/usb/gadget/legacy/raw_gadget.c:535 raw_ioctl_event_fetch() warn: maybe return -EFAULT instead of the bytes remaining?
drivers/usb/gadget/legacy/raw_gadget.c:546 raw_alloc_io_data() error: passing non negative 8 to ERR_PTR
drivers/usb/gadget/legacy/raw_gadget.c:668 raw_ioctl_ep0_read() warn: maybe return -EFAULT instead of the bytes remaining?
drivers/usb/gadget/legacy/raw_gadget.c:962 raw_ioctl_ep_read() warn: maybe return -EFAULT instead of the bytes remaining?

# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=f2c2e717642c66f7fe7e5dd69b2e8ff5849f4d10
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git remote update linus
git checkout f2c2e717642c66f7fe7e5dd69b2e8ff5849f4d10
vim +102 drivers/usb/gadget/legacy/raw_gadget.c

f2c2e717642c66 Andrey Konovalov 2020-02-24   80  
f2c2e717642c66 Andrey Konovalov 2020-02-24   81  static struct usb_raw_event *raw_event_queue_fetch(
f2c2e717642c66 Andrey Konovalov 2020-02-24   82  				struct raw_event_queue *queue)
f2c2e717642c66 Andrey Konovalov 2020-02-24   83  {
f2c2e717642c66 Andrey Konovalov 2020-02-24   84  	unsigned long flags;
f2c2e717642c66 Andrey Konovalov 2020-02-24   85  	struct usb_raw_event *event;
f2c2e717642c66 Andrey Konovalov 2020-02-24   86  
f2c2e717642c66 Andrey Konovalov 2020-02-24   87  	/*
f2c2e717642c66 Andrey Konovalov 2020-02-24   88  	 * This function can be called concurrently. We first check that
f2c2e717642c66 Andrey Konovalov 2020-02-24   89  	 * there's at least one event queued by decrementing the semaphore,
f2c2e717642c66 Andrey Konovalov 2020-02-24   90  	 * and then take the lock to protect queue struct fields.
f2c2e717642c66 Andrey Konovalov 2020-02-24   91  	 */
f2c2e717642c66 Andrey Konovalov 2020-02-24   92  	if (down_interruptible(&queue->sema))
f2c2e717642c66 Andrey Konovalov 2020-02-24   93  		return NULL;
f2c2e717642c66 Andrey Konovalov 2020-02-24   94  	spin_lock_irqsave(&queue->lock, flags);
f2c2e717642c66 Andrey Konovalov 2020-02-24   95  	if (WARN_ON(!queue->size))
f2c2e717642c66 Andrey Konovalov 2020-02-24   96  		return NULL;
f2c2e717642c66 Andrey Konovalov 2020-02-24   97  	event = queue->events[0];
f2c2e717642c66 Andrey Konovalov 2020-02-24   98  	queue->size--;
f2c2e717642c66 Andrey Konovalov 2020-02-24   99  	memmove(&queue->events[0], &queue->events[1],
f2c2e717642c66 Andrey Konovalov 2020-02-24  100  			queue->size * sizeof(queue->events[0]));
f2c2e717642c66 Andrey Konovalov 2020-02-24  101  	spin_unlock_irqrestore(&queue->lock, flags);
f2c2e717642c66 Andrey Konovalov 2020-02-24 @102  	return event;
f2c2e717642c66 Andrey Konovalov 2020-02-24  103  }
f2c2e717642c66 Andrey Konovalov 2020-02-24  104  

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

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

                 reply	other threads:[~2020-06-02  6:08 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=202006021403.hj36Xerk%lkp@intel.com \
    --to=lkp@intel.com \
    --cc=kbuild@lists.01.org \
    /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.