提交 6b81bef8 编写于 作者: J Julia Lawall 提交者: Mauro Carvalho Chehab

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: NJulia Lawall <julia@diku.dk>
Signed-off-by: NMauro Carvalho Chehab <mchehab@redhat.com>
上级 d7ef485d
......@@ -277,12 +277,13 @@ static void em28xx_copy_vbi(struct em28xx *dev,
{
void *startwrite, *startread;
int offset;
int bytesperline = dev->vbi_width;
int bytesperline;
if (dev == NULL) {
em28xx_isocdbg("dev is null\n");
return;
}
bytesperline = dev->vbi_width;
if (dma_q == NULL) {
em28xx_isocdbg("dma_q is null\n");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册