aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wimax/i2400m/usb-fw.c
diff options
context:
space:
mode:
authorInaky Perez-Gonzalez <inaky@linux.intel.com>2009-08-31 20:15:49 -0400
committerInaky Perez-Gonzalez <inaky@linux.intel.com>2009-10-19 02:55:46 -0400
commit77e1251a7cc64c1e483a31c41c139fdf8121e75e (patch)
tree03f0f2cc77eb0335073c64883c5fd56217219713 /drivers/net/wimax/i2400m/usb-fw.c
parent339ccc362cb60b48e478ff494172efadb385c0ab (diff)
wimax/i2400m: be smarter about copying command buffer to bm_cmd_buf
Because some underlying bus APIs (like USB) don't like data buffers in the stack or vmalloced areas, the i2400m driver provides a scratch buffer (i2400m->bm_cmd_buf) for said low-level drivers to copy command data to before passing it to said API. This is only used during boot mode. However, at some the code was copying the buffer even when the command was already specified in said buffer. This is ok, but it needs to be more careful. As thus, change so that: (a) the copy happens only if command buffer is not the scratch buffer (b) use memmove() in case there is overlapping Signed-off-by: Inaky Perez-Gonzalez <inaky@linux.intel.com>
Diffstat (limited to 'drivers/net/wimax/i2400m/usb-fw.c')
-rw-r--r--drivers/net/wimax/i2400m/usb-fw.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/net/wimax/i2400m/usb-fw.c b/drivers/net/wimax/i2400m/usb-fw.c
index a2250e49a444..f162c815d505 100644
--- a/drivers/net/wimax/i2400m/usb-fw.c
+++ b/drivers/net/wimax/i2400m/usb-fw.c
@@ -172,7 +172,8 @@ ssize_t i2400mu_bus_bm_cmd_send(struct i2400m *i2400m,
172 result = -E2BIG; 172 result = -E2BIG;
173 if (cmd_size > I2400M_BM_CMD_BUF_SIZE) 173 if (cmd_size > I2400M_BM_CMD_BUF_SIZE)
174 goto error_too_big; 174 goto error_too_big;
175 memcpy(i2400m->bm_cmd_buf, _cmd, cmd_size); 175 if (_cmd != i2400m->bm_cmd_buf)
176 memmove(i2400m->bm_cmd_buf, _cmd, cmd_size);
176 cmd = i2400m->bm_cmd_buf; 177 cmd = i2400m->bm_cmd_buf;
177 if (cmd_size_a > cmd_size) /* Zero pad space */ 178 if (cmd_size_a > cmd_size) /* Zero pad space */
178 memset(i2400m->bm_cmd_buf + cmd_size, 0, cmd_size_a - cmd_size); 179 memset(i2400m->bm_cmd_buf + cmd_size, 0, cmd_size_a - cmd_size);