From: NeilBrown Date: Wed, 1 Sep 2010 06:14:26 +0000 (+1000) Subject: intel: Don't try to read from tiny devices. X-Git-Tag: mdadm-3.2~327 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=64436f0628a14f4e979b93bea57aba4b4c6143e8;p=thirdparty%2Fmdadm.git intel: Don't try to read from tiny devices. 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 --- diff --git a/super-intel.c b/super-intel.c index b880a74c..f438044e 100644 --- a/super-intel.c +++ b/super-intel.c @@ -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)