[PATCH 2/11] drivers/watchdog: Eliminate a NULL pointer dereference
[safe/jmp/linux-2.6] / init / do_mounts_rd.c
index a015e26..bf3ef66 100644 (file)
@@ -7,6 +7,7 @@
 #include <linux/cramfs_fs.h>
 #include <linux/initrd.h>
 #include <linux/string.h>
+#include <linux/slab.h>
 
 #include "do_mounts.h"
 #include "../fs/squashfs/squashfs_fs.h"
@@ -79,9 +80,13 @@ identify_ramdisk_image(int fd, int start_block, decompress_fn *decompressor)
        sys_read(fd, buf, size);
 
        *decompressor = decompress_method(buf, size, &compress_name);
-       if (*decompressor) {
+       if (compress_name) {
                printk(KERN_NOTICE "RAMDISK: %s image found at block %d\n",
                       compress_name, start_block);
+               if (!*decompressor)
+                       printk(KERN_EMERG
+                              "RAMDISK: %s decompressor not configured!\n",
+                              compress_name);
                nblocks = 0;
                goto done;
        }