From 0cf83229992c42cd1a48a29c1fd5c610934714b3 Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Mon, 13 May 2013 17:09:55 +1000 Subject: [PATCH] Always test return value of posix_memalign. FORTIFY_SOURCE likes this, and it is good practice. Signed-off-by: NeilBrown --- super1.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/super1.c b/super1.c index eb81275..92e51f7 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;