Skip to content

Commit

Permalink
[media] tm6000: fix vbuf may be used uninitialized
Browse files Browse the repository at this point in the history
In commit 8aff8ba, most of the manipulations to vbuf inside
copy_streams were gated on if !dev->radio, but one place that touches
vbuf lays outside those gates -- a memcpy of vbuf isn't NULL. If we
initialize vbuf to NULL, that memcpy will never happen in the case where
we do have dev->radio, and otherwise, in the !dev->radio case, the code
behaves exactly like it did prior to 8aff8ba.

While we're at it, also fix an incorrectly indented closing brace for
one of the sections touching vbuf that is conditional on !dev->radio.

Signed-off-by: Jarod Wilson <jarod@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
  • Loading branch information
Jarod Wilson authored and Mauro Carvalho Chehab committed May 20, 2011
1 parent 990528e commit cc73b4b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/staging/tm6000/tm6000-video.c
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ static int copy_streams(u8 *data, unsigned long len,
unsigned long header = 0;
int rc = 0;
unsigned int cmd, cpysize, pktsize, size, field, block, line, pos = 0;
struct tm6000_buffer *vbuf;
struct tm6000_buffer *vbuf = NULL;
char *voutp = NULL;
unsigned int linewidth;

Expand Down Expand Up @@ -318,7 +318,7 @@ static int copy_streams(u8 *data, unsigned long len,
if (pos + size > vbuf->vb.size)
cmd = TM6000_URB_MSG_ERR;
dev->isoc_ctl.vfield = field;
}
}
break;
case TM6000_URB_MSG_VBI:
break;
Expand Down

0 comments on commit cc73b4b

Please sign in to comment.