Skip to contentSkip to conversation

tm6000: Don't copy outside the buffer

PATCH New Mauro Carvalho Chehab 1 participant 1 message May 2, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tm6000: Don't copy outside the buffer

tm6000 tm6000_irq_callback :urb resubmit failed (error=-1)

BUG: unable to handle kernel paging request at 000000000100f700
IP: [<ffffffffa007ee79>] tm6000_irq_callback+0x51e/0xac7 [tm6000]

(gdb) list * tm6000_irq_callback+0x51e
0x2e79 is in tm6000_irq_callback (drivers/staging/tm6000/tm6000-video.c:363).
358 dev->isoc_ctl.tmp_buf_len--;
359 }
360 if (dev->isoc_ctl.tmp_buf_len) {
361 memcpy (&header,p,
362 dev->isoc_ctl.tmp_buf_l$
363 memcpy (((u8 *)header)+

364                                                     dev->isoc_ctl.tmp_buf,
365                                                     ptr,
366                                                     4-dev->isoc_ctl.tmp_buf$

367 ptr+=4-dev->isoc_ctl.tmp_buf_le$

drivers/staging/tm6000/tm6000-video.c +5 -5
index 3317220..4444487 100644
@@ -358,13 +358,13 @@ static int copy_streams(u8 *data, u8 *out_p, unsigned long len,
 					dev->isoc_ctl.tmp_buf_len--;
 				}
 				if (dev->isoc_ctl.tmp_buf_len) {
-					memcpy (&header,p,
+					memcpy(&header, p,
 						dev->isoc_ctl.tmp_buf_len);
-					memcpy (((u8 *)header)+
-						dev->isoc_ctl.tmp_buf,
+					memcpy((u8 *)&header +
+						dev->isoc_ctl.tmp_buf_len,
 						ptr,
-						4-dev->isoc_ctl.tmp_buf_len);
-					ptr+=4-dev->isoc_ctl.tmp_buf_len;
+						4 - dev->isoc_ctl.tmp_buf_len);
+					ptr += 4 - dev->isoc_ctl.tmp_buf_len;
 					goto HEADER;
 				}
 			}
Signature · 2 lines
Cheers,
Mauro