projects
/
linux-2.6-microblaze.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
1cfc667
)
greybus: es1: no BUG_ON() code, report an error and recover.
author
Greg Kroah-Hartman
<greg@kroah.com>
Wed, 1 Oct 2014 01:21:36 +0000
(18:21 -0700)
committer
Greg Kroah-Hartman
<greg@kroah.com>
Wed, 1 Oct 2014 01:21:36 +0000
(18:21 -0700)
drivers/staging/greybus/es1-ap-usb.c
patch
|
blob
|
history
diff --git
a/drivers/staging/greybus/es1-ap-usb.c
b/drivers/staging/greybus/es1-ap-usb.c
index
410acd3
..
f23c674
100644
(file)
--- a/
drivers/staging/greybus/es1-ap-usb.c
+++ b/
drivers/staging/greybus/es1-ap-usb.c
@@
-116,7
+116,13
@@
static int alloc_gbuf_data(struct gbuf *gbuf, unsigned int size, gfp_t gfp_mask)
* we will encode the cport number in the first byte of the buffer, so
* set the second byte to be the "transfer buffer"
*/
- BUG_ON(gbuf->cport_id > (u16)U8_MAX);
+ if (gbuf->cport_id > (u16)U8_MAX) {
+ pr_err("gbuf->cport_id is '%d' and is out of range!\n",
+ gbuf->cport_id);
+ kfree(buffer);
+ return -EINVAL;
+ }
+
buffer[0] = gbuf->cport_id;
gbuf->transfer_buffer = &buffer[1];
gbuf->transfer_buffer_length = size;