[PATCH] arcfb: Fix dereference before NULL check
authorAntonino A. Daplas <adaplas@gmail.com>
Sat, 11 Mar 2006 11:27:23 +0000 (03:27 -0800)
committerLinus Torvalds <torvalds@g5.osdl.org>
Sat, 11 Mar 2006 17:19:35 +0000 (09:19 -0800)
info->par is dereferenced before info is checked for NULL. Fix.

Coverity Bug 833

Signed-off-by: Antonino Daplas <adaplas@pol.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
drivers/video/arcfb.c

index 0cf26da75b6d10e0bfd3f48fe22034e4f59f0fec..466042808dafabec885e89da3b103712a8908ac7 100644 (file)
@@ -459,11 +459,11 @@ static ssize_t arcfb_write(struct file *file, const char __user *buf, size_t cou
        inode = file->f_dentry->d_inode;
        fbidx = iminor(inode);
        info = registered_fb[fbidx];
-       par = info->par;
 
        if (!info || !info->screen_base)
                return -ENODEV;
 
+       par = info->par;
        xres = info->var.xres;
        fbmemlength = (xres * info->var.yres)/8;