I changed the dma buffers to use allocated memory instead of stack
memory.
The reason for this is documented in Documentation/DMA-API-HOWTO.txt
under the section: "What memory is DMA'able?" That document was only
added a couple weeks ago and there are still lots of modules which
haven't been corrected yet. Btw. Smatch includes a pretty good test to
find places which use stack memory as a dma buffer. That's how I found
these. (http://smatch.sf.net).
Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
u16 value;
u16 index;
int blen;
u16 value;
u16 index;
int blen;
if (slot != 0)
return -EINVAL;
if (slot != 0)
return -EINVAL;
+ b = kmalloc(12, GFP_KERNEL);
+ if (!b)
+ return -ENOMEM;
+
mutex_lock(&state->ca_mutex);
req = 0xC1;
mutex_lock(&state->ca_mutex);
req = 0xC1;
}
mutex_unlock(&state->ca_mutex);
}
mutex_unlock(&state->ca_mutex);
u16 value;
u16 index;
int blen;
u16 value;
u16 index;
int blen;
if (slot != 0)
return -EINVAL;
if (slot != 0)
return -EINVAL;
+ b = kmalloc(12, GFP_KERNEL);
+ if (!b)
+ return -ENOMEM;
+
mutex_lock(&state->ca_mutex);
req = 0xC3;
mutex_lock(&state->ca_mutex);
req = 0xC3;
}
mutex_unlock(&state->ca_mutex);
}
mutex_unlock(&state->ca_mutex);
u16 value;
u16 index;
int blen;
u16 value;
u16 index;
int blen;
+ u8 *b;
+
+ b = kmalloc(12, GFP_KERNEL);
+ if (!b)
+ return -ENOMEM;
u16 value;
u16 index;
int blen;
u16 value;
u16 index;
int blen;
+ b = kmalloc(12, GFP_KERNEL);
+ if (!b)
+ return -ENOMEM;
mutex_lock(&state->ca_mutex);
req = 0xC5;
mutex_lock(&state->ca_mutex);
req = 0xC5;
}
mutex_unlock(&state->ca_mutex);
}
mutex_unlock(&state->ca_mutex);
u16 value;
int length;
u8 req;
u16 value;
int length;
u8 req;
+ u8 *data;
+
+ data = kmalloc(256, GFP_KERNEL);
+ if (!data)
+ return -ENOMEM;
- if (mutex_lock_interruptible(&d->i2c_mutex) < 0)
+ if (mutex_lock_interruptible(&d->i2c_mutex) < 0) {
+ kfree(data);
if (num > 2)
warn("more than 2 i2c messages at a time is not handled yet. TODO.");
if (num > 2)
warn("more than 2 i2c messages at a time is not handled yet. TODO.");
}
}
mutex_unlock(&d->i2c_mutex);
}
}
mutex_unlock(&d->i2c_mutex);
struct dvb_usb_device_description **desc,
int *cold)
{
struct dvb_usb_device_description **desc,
int *cold)
{
- u8 b[16];
- s16 ret = usb_control_msg(udev,
+ u8 *b;
+ s16 ret;
+
+ b = kmalloc(16, GFP_KERNEL);
+ if (!b)
+ return -ENOMEM;
+
+ ret = usb_control_msg(udev,
usb_rcvctrlpipe(udev, 0),
0xb7,
USB_TYPE_VENDOR | USB_DIR_IN,
usb_rcvctrlpipe(udev, 0),
0xb7,
USB_TYPE_VENDOR | USB_DIR_IN,
USB_CTRL_GET_TIMEOUT);
*cold = ret <= 0;
USB_CTRL_GET_TIMEOUT);
*cold = ret <= 0;
deb_info("cold: %d\n", *cold);
return 0;
}
deb_info("cold: %d\n", *cold);
return 0;
}