From: Dan Williams Date: Sun, 28 Sep 2008 19:12:08 +0000 (-0700) Subject: non-trivial warn_unused_result fix, prepare_update X-Git-Tag: mdadm-3.0-devel2~84 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e6b9548dce2635d91a9debfe25b4af792a572e4e;p=thirdparty%2Fmdadm.git 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 --- diff --git a/super-ddf.c b/super-ddf.c index 527e3263..db6476b1 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; } /*