Commit c60e55f3 authored by Julia Lawall's avatar Julia Lawall Committed by Greg Kroah-Hartman

Staging: Eliminate a NULL pointer dereference

Eliminate a NULL or near NULL pointer 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
  return ...;
}
else S3
// </smpl>
Signed-off-by: default avatarJulia Lawall <julia@diku.dk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 0aa3f139
...@@ -351,8 +351,7 @@ static int usbdux_ai_stop(struct usbduxsub *this_usbduxsub, int do_unlink) ...@@ -351,8 +351,7 @@ static int usbdux_ai_stop(struct usbduxsub *this_usbduxsub, int do_unlink)
int ret = 0; int ret = 0;
if (!this_usbduxsub) { if (!this_usbduxsub) {
dev_err(&this_usbduxsub->interface->dev, pr_err("comedi?: usbdux_ai_stop: this_usbduxsub=NULL!\n");
"comedi?: usbdux_ai_stop: this_usbduxsub=NULL!\n");
return -EFAULT; return -EFAULT;
} }
dev_dbg(&this_usbduxsub->interface->dev, "comedi: usbdux_ai_stop\n"); dev_dbg(&this_usbduxsub->interface->dev, "comedi: usbdux_ai_stop\n");
......
...@@ -176,9 +176,7 @@ int allocator_free_dma(unsigned long address) ...@@ -176,9 +176,7 @@ int allocator_free_dma(unsigned long address)
prev = ptr; ptr = ptr->next; prev = ptr; ptr = ptr->next;
if (!ptr) { if (!ptr) {
printk(KERN_ERR ALL_MSG pr_err(ALL_MSG "free_dma but add. not allocated\n");
"free_dma(0x%08lx) but add. not allocated\n",
ptr->address);
return -EINVAL; return -EINVAL;
} }
PDEBUGG("freeing: %08lx (%li) next %08lx\n", ptr->address, ptr->size, PDEBUGG("freeing: %08lx (%li) next %08lx\n", ptr->address, ptr->size,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment