Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

usb: gadget: rndis: fix itnull.cocci warnings

The index variable of list_for_each_entry_safe is an offset from a list
pointer, and thus should not be NULL.

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

CC: Geliang Tang <geliangtang@163.com>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Julia Lawall and committed by
Greg Kroah-Hartman
1c17a353 b4a90d04

+1 -1
+1 -1
drivers/usb/gadget/function/rndis.c
··· 1009 1009 rndis_resp_t *r, *n; 1010 1010 1011 1011 list_for_each_entry_safe(r, n, &params->resp_queue, list) { 1012 - if (r && r->buf == buf) { 1012 + if (r->buf == buf) { 1013 1013 list_del(&r->list); 1014 1014 kfree(r); 1015 1015 }