Skip to contentSkip to conversation

NOUPSTREAM: ANDROID: usb: gadget: configfs: fix itnull.cocci warnings (fwd)

PATCH New Julia Lawall 1 participant 1 message Dec 10, 2021 USB

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 NOUPSTREAM: ANDROID: usb: gadget: configfs: fix itnull.cocci warnings (fwd)

Hello,

The patch with the call to BAD is a Coccinelle hack, but it remains the case that fi cannot be NULL in the first line of the body of the list_for_each loop.

julia

---------- Forwarded message ----------
Date: Tue, 7 Dec 2021 18:50:38 +0800
From: kernel test robot <[email protected]>
To: kbuild(a)lists.01.org
Cc: lkp(a)intel.com, Julia Lawall <[email protected]>
Subject: [PATCH] NOUPSTREAM: ANDROID: usb: gadget: configfs: fix itnull.cocci
warnings

CC: kbuild-all(a)lists.01.org
TO: cros-kernel-buildreports(a)googlegroups.com
TO: Guenter Roeck <[email protected]>

From: kernel test robot <[email protected]>

drivers/usb/gadget/configfs.c:1554:6-8: ERROR: iterator variable bound on line 1553 cannot be NULL

Many iterators have the property that the first argument is always bound to a real list element, never NULL.

Semantic patch information:
False positives arise for some iterators that do not have this property, or in cases when the loop cursor is reassigned. The latter should only happen when the matched code is on the way to a loop exit (break, goto, or return).

Generated by: scripts/coccinelle/iterators/itnull.cocci

---

tree:   https://chromium.googlesource.com/chromiumos/third_party/kernel chromeos-5.15
head:   617fec3654adc5dfc39d303b5b371fc4e1be600b
commit: db87c70afb233e6f6c5fb8164f92b1bef4690a1b [1992/2561] NOUPSTREAM: ANDROID: usb: gadget: configfs: Add Uevent to notify userspace

:::::: branch date: 8 hours ago
:::::: commit date: 2 weeks ago

Please take the patch only if it's a positive warning. Thanks!

 configfs.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/gadget/configfs.c +1 -1
@@ -1551,7 +1551,7 @@ static int android_setup(struct usb_gadg
 	}
 	spin_unlock_irqrestore(&cdev->lock, flags);
 	list_for_each_entry(fi, &gi->available_func, cfs_list) {
-		if (fi != NULL && fi->f != NULL && fi->f->setup != NULL) {
+		if (BAD(fi != NULL) && fi->f != NULL && fi->f->setup != NULL) {
 			value = fi->f->setup(fi->f, c);
 			if (value >= 0)
 				break;