diff options
author | Dan Williams <dan.j.williams@intel.com> | 2008-09-28 12:12:08 -0700 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2008-10-15 14:15:52 -0700 |
commit | e6b9548dce2635d91a9debfe25b4af792a572e4e (patch) | |
tree | 46d09fa803053a7ca34126346f802f1f7ececf2f /super-ddf.c | |
parent | 792449393d1792e1bdb45aedada395f345564484 (diff) | |
download | mdadm-e6b9548dce2635d91a9debfe25b4af792a572e4e.tar.gz mdadm-e6b9548dce2635d91a9debfe25b4af792a572e4e.tar.xz mdadm-e6b9548dce2635d91a9debfe25b4af792a572e4e.zip |
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 <dan.j.williams@intel.com>
Diffstat (limited to 'super-ddf.c')
-rw-r--r-- | super-ddf.c | 7 |
1 files 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; } /* |