[PATCH] coverity: fix fbsysfs null pointer check
authorKAMBAROV, ZAUR <kambarov@berkeley.edu>
Fri, 8 Jul 2005 00:57:05 +0000 (17:57 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Fri, 8 Jul 2005 01:23:47 +0000 (18:23 -0700)
Correctly test for a null pointer before going and dereferencing it.

This defect was found automatically by Coverity Prevent, a static analysis
tool.

Signed-off-by: Zaur Kambarov <zkambarov@coverity.com>
Cc: <linux-fbdev-devel@lists.sourceforge.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
drivers/video/fbsysfs.c

index 7dfbf39..ddc9443 100644 (file)
@@ -256,7 +256,7 @@ static ssize_t show_cmap(struct class_device *class_device, char *buf)
        unsigned int offset = 0, i;
 
        if (!fb_info->cmap.red || !fb_info->cmap.blue ||
-           fb_info->cmap.green || fb_info->cmap.transp)
+           !fb_info->cmap.green || !fb_info->cmap.transp)
                return -EINVAL;
 
        for (i = 0; i < fb_info->cmap.len; i++) {