From e6b9548dce2635d91a9debfe25b4af792a572e4e Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Sun, 28 Sep 2008 12:12:08 -0700 Subject: [PATCH] non-trivial warn_unused_result fix, prepare_update If an allocation fails in ->prepare_update we need to catch it in ->process_update. Signed-off-by: Dan Williams --- super-ddf.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/super-ddf.c b/super-ddf.c index 527e326..db6476b 100644 --- a/super-ddf.c +++ b/super-ddf.c @@ -3076,6 +3076,8 @@ static void ddf_process_update(struct supertype *st, mppe * (sizeof(__u32) + sizeof(__u64))); } else { /* A new VD_CONF */ + if (!update->space) + return; vcl = update->space; update->space = NULL; vcl->next = ddf->conflist; @@ -3136,9 +3138,10 @@ static void ddf_prepare_update(struct supertype *st, struct ddf_super *ddf = st->sb; __u32 *magic = (__u32*)update->buf; if (*magic == DDF_VD_CONF_MAGIC) - posix_memalign(&update->space, 512, + if (posix_memalign(&update->space, 512, offsetof(struct vcl, conf) - + ddf->conf_rec_len * 512); + + ddf->conf_rec_len * 512) != 0) + update->space = NULL; } /*