summaryrefslogtreecommitdiff
path: root/super1.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2013-05-13 17:09:55 +1000
committerNeilBrown <neilb@suse.de>2013-05-13 17:09:55 +1000
commit0cf83229992c42cd1a48a29c1fd5c610934714b3 (patch)
treef6f9f8c17c8d51f0503e6001ab263e785f7cd4d7 /super1.c
parent5a23a06ea472460ae3beddf9140923570268e3dd (diff)
Always test return value of posix_memalign.
FORTIFY_SOURCE likes this, and it is good practice. Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'super1.c')
-rw-r--r--super1.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/super1.c b/super1.c
index eb812757..92e51f7c 100644
--- 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;