From 64436f0628a14f4e979b93bea57aba4b4c6143e8 Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Wed, 1 Sep 2010 16:14:26 +1000 Subject: [PATCH] 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 --- super-intel.c | 7 +++++++ 1 file changed, 7 insertions(+) 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) -- 2.39.2