Always test return value of posix_memalign.

FORTIFY_SOURCE likes this, and it is good practice.

Signed-off-by: NeilBrown <neilb@suse.de>
This commit is contained in:
NeilBrown 2013-05-13 17:09:55 +10:00
parent 5a23a06ea4
commit 0cf8322999
1 changed files with 4 additions and 1 deletions

View File

@ -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;