Skip to contentSkip to conversation

ehci-dbg.c:656 fill_periodic_buffer() warn: variable dereferenced before check 'p.qh' (see line 599)

DISCUSSION Fengguang Wu 2 participants 2 messages Sep 13, 2012 – Sep 14, 2012 Kernel janitors

lore
Share & tools
lore
#0 lore raw

Hi Richard,

FYI, there are new smatch warnings show up in

commit 3807e26d69b9ad3864fe03224ebebc9610d5802e

Author:     Alek Du <[email protected]>
AuthorDate: Tue Jul 14 07:23:29 2009 +0800

drivers/usb/chipidea/../host/ehci-dbg.c:656 fill_periodic_buffer() warn: variable dereferenced before check 'p.qh' (see line 599)

vim +656 drivers/usb/chipidea/../host/ehci-dbg.c
596
597 switch (hc32_to_cpu(ehci, tag)) {
598 case Q_TYPE_QH:
599 hw = p.qh->hw;
...

Quoted 1 line

656 if (p.qh) {

657 tag = Q_NEXT_TYPE(ehci, hw->hw_next);
658 p = p.qh->qh_next;
659 }
660 break;

---
0-DAY kernel build testing backend Open Source Technology Centre
Fengguang Wu <[email protected]> Intel Corporation

#1 lore raw

Re: ehci-dbg.c:656 fill_periodic_buffer() warn: variable dereferenced before check 'p.qh' (see line

Quoted 14 lines · Fengguang Wu

Hi Richard,

FYI, there are new smatch warnings show up in

commit 3807e26d69b9ad3864fe03224ebebc9610d5802e

Author:     Alek Du <[email protected]>
AuthorDate: Tue Jul 14 07:23:29 2009 +0800

drivers/usb/chipidea/../host/ehci-dbg.c:656 fill_periodic_buffer() warn: variable dereferenced before check 'p.qh' (see line 599)

vim +656 drivers/usb/chipidea/../host/ehci-dbg.c
596
597 switch (hc32_to_cpu(ehci, tag)) {
598 case Q_TYPE_QH:

Quoted 7 lines
   599                                 hw = p.qh->hw;

...

Quoted 1 line

656 if (p.qh) {

   657						tag = Q_NEXT_TYPE(ehci, hw->hw_next);
   658						p = p.qh->qh_next;
   659					}
   660					break;

smatch is right; the test on line 656 isn't needed. I'll take it out.

Thank you.

Alan Stern