diff options
author | NeilBrown <neilb@suse.de> | 2013-05-13 17:09:55 +1000 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2013-05-13 17:09:55 +1000 |
commit | 0cf83229992c42cd1a48a29c1fd5c610934714b3 (patch) | |
tree | f6f9f8c17c8d51f0503e6001ab263e785f7cd4d7 /super1.c | |
parent | 5a23a06ea472460ae3beddf9140923570268e3dd (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.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -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; |