]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
intel: Don't try to read from tiny devices.
authorNeilBrown <neilb@suse.de>
Wed, 1 Sep 2010 06:14:26 +0000 (16:14 +1000)
committerNeilBrown <neilb@suse.de>
Mon, 6 Sep 2010 01:26:28 +0000 (11:26 +1000)
If a device is less than 1K, avoid even trying to seek to 1K before
the end.
The seek will fail anyway so this is a fairly cosmetic fix.

Signed-off-by: NeilBrown <neilb@suse.de>
super-intel.c

index b880a74c4b16f8890c0edfb6ad54289274fe518e..f438044e82587daf40364c55b000d6de14482c34 100644 (file)
@@ -2199,6 +2199,13 @@ static int load_imsm_mpb(int fd, struct intel_super *super, char *devname)
        __u32 check_sum;
 
        get_dev_size(fd, NULL, &dsize);
+       if (dsize < 1024) {
+               if (devname)
+                       fprintf(stderr,
+                               Name ": %s: device to small for imsm\n",
+                               devname);
+               return 1;
+       }
 
        if (lseek64(fd, dsize - (512 * 2), SEEK_SET) < 0) {
                if (devname)