diff options
author | Julia Lawall <julia@diku.dk> | 2010-08-27 01:57:18 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-10-20 23:04:53 -0400 |
commit | 6b81bef8cde141d8d8172a35633af27e17cf487a (patch) | |
tree | acf25b15739555f54828e6a1f7cb9197ca908b32 /drivers/media/video/em28xx | |
parent | d7ef485daa657456cad4994873148377b3561b8b (diff) |
V4L/DVB: drivers/media/video/em28xx: Remove potential NULL dereference
If the NULL test is necessary, the initialization involving a dereference of
the tested value should be moved after the NULL test.
The sematic patch that fixes this problem is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@@
type T;
expression E;
identifier i,fld;
statement S;
@@
- T i = E->fld;
+ T i;
... when != E
when != i
if (E == NULL) S
+ i = E->fld;
// </smpl>
Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/em28xx')
-rw-r--r-- | drivers/media/video/em28xx/em28xx-video.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c index 7b9ec6e493e4..95a4b60a1eda 100644 --- a/drivers/media/video/em28xx/em28xx-video.c +++ b/drivers/media/video/em28xx/em28xx-video.c | |||
@@ -277,12 +277,13 @@ static void em28xx_copy_vbi(struct em28xx *dev, | |||
277 | { | 277 | { |
278 | void *startwrite, *startread; | 278 | void *startwrite, *startread; |
279 | int offset; | 279 | int offset; |
280 | int bytesperline = dev->vbi_width; | 280 | int bytesperline; |
281 | 281 | ||
282 | if (dev == NULL) { | 282 | if (dev == NULL) { |
283 | em28xx_isocdbg("dev is null\n"); | 283 | em28xx_isocdbg("dev is null\n"); |
284 | return; | 284 | return; |
285 | } | 285 | } |
286 | bytesperline = dev->vbi_width; | ||
286 | 287 | ||
287 | if (dma_q == NULL) { | 288 | if (dma_q == NULL) { |
288 | em28xx_isocdbg("dma_q is null\n"); | 289 | em28xx_isocdbg("dma_q is null\n"); |