diff options
author | Julia Lawall <julia@diku.dk> | 2010-05-27 12:10:08 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-08-10 17:35:34 -0400 |
commit | dc6eb27bdd3d214568f7d77a317c202c10222511 (patch) | |
tree | 81583901b296bb8ddc3327a5b2a8c2842977d6bb /drivers/usb/host/whci | |
parent | 6e1c3b467ffd9d6eb725dda544f6fd10e471ea71 (diff) |
USB: host: Eliminate NULL dereference
The test above allows std to be NULL, so check that std is not NULL before
doing the dereference.
A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)
// <smpl>
@r exists@
expression E,E1;
identifier f;
statement S1,S2,S3;
@@
if ((E == NULL && ...) || ...)
{
... when != if (...) S1 else S2
when != E = E1
* E->f
... when any
}
else S3
// </smpl>
Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/host/whci')
-rw-r--r-- | drivers/usb/host/whci/qset.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/usb/host/whci/qset.c b/drivers/usb/host/whci/qset.c index ab5a14fbfeeb..dc0ab8382f5d 100644 --- a/drivers/usb/host/whci/qset.c +++ b/drivers/usb/host/whci/qset.c | |||
@@ -475,7 +475,7 @@ static int qset_add_urb_sg(struct whc *whc, struct whc_qset *qset, struct urb *u | |||
475 | || (prev_end & (WHCI_PAGE_SIZE-1)) | 475 | || (prev_end & (WHCI_PAGE_SIZE-1)) |
476 | || (dma_addr & (WHCI_PAGE_SIZE-1)) | 476 | || (dma_addr & (WHCI_PAGE_SIZE-1)) |
477 | || std->len + WHCI_PAGE_SIZE > QTD_MAX_XFER_SIZE) { | 477 | || std->len + WHCI_PAGE_SIZE > QTD_MAX_XFER_SIZE) { |
478 | if (std->len % qset->max_packet != 0) | 478 | if (std && std->len % qset->max_packet != 0) |
479 | return -EINVAL; | 479 | return -EINVAL; |
480 | std = qset_new_std(whc, qset, urb, mem_flags); | 480 | std = qset_new_std(whc, qset, urb, mem_flags); |
481 | if (std == NULL) { | 481 | if (std == NULL) { |