]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Always test return value of posix_memalign.
authorNeilBrown <neilb@suse.de>
Mon, 13 May 2013 07:09:55 +0000 (17:09 +1000)
committerNeilBrown <neilb@suse.de>
Mon, 13 May 2013 07:09:55 +0000 (17:09 +1000)
FORTIFY_SOURCE likes this, and it is good practice.

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

index eb812757b0a13c29741f6b2fe37c3e34f95cea63..92e51f7c4560c6573d911c1a55f529651e763a80 100644 (file)
--- a/super1.c
+++ b/super1.c
@@ -668,7 +668,10 @@ static int examine_badblocks_super1(struct supertype *st, int fd, char *devname)
        }
 
        size = __le32_to_cpu(sb->bblog_size)* 512;
-       posix_memalign((void**)&bbl, 4096, size);
+       if (posix_memalign((void**)&bbl, 4096, size) != 0) {
+               pr_err("%s could not allocate badblocks list\n", __func__);
+               return 0;
+       }
        offset = __le64_to_cpu(sb->super_offset) +
                (int)__le32_to_cpu(sb->bblog_offset);
        offset <<= 9;