]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
viafb: NULL dereference on allocation failure in query_edid()
authorDan Carpenter <dan.carpenter@oracle.com>
Fri, 17 Feb 2012 06:45:01 +0000 (09:45 +0300)
committerFlorian Tobias Schandinat <FlorianSchandinat@gmx.de>
Fri, 17 Feb 2012 07:56:21 +0000 (07:56 +0000)
We should handle the allocation here, if only to keep the static
checkers happy.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
drivers/video/via/via_aux_edid.c

index 03f7a41c8a3fdaf30966bd63816e031cce175bd9..754d4509033fd6ec0b98ce199a0cebf3a4487a93 100644 (file)
@@ -36,10 +36,13 @@ static void query_edid(struct via_aux_drv *drv)
        unsigned char edid[EDID_LENGTH];
        bool valid = false;
 
-       if (spec)
+       if (spec) {
                fb_destroy_modedb(spec->modedb);
-       else
+       } else {
                spec = kmalloc(sizeof(*spec), GFP_KERNEL);
+               if (!spec)
+                       return;
+       }
 
        spec->version = spec->revision = 0;
        if (via_aux_read(drv, 0x00, edid, EDID_LENGTH)) {