]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
non-trivial warn_unused_result fix, prepare_update
authorDan Williams <dan.j.williams@intel.com>
Sun, 28 Sep 2008 19:12:08 +0000 (12:12 -0700)
committerDan Williams <dan.j.williams@intel.com>
Wed, 15 Oct 2008 21:15:52 +0000 (14:15 -0700)
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>
super-ddf.c

index 527e32635da56fe61f60fb2e3cab08f11fe3c8a8..db6476b14c0115e0c9af3481d0c367d6df178956 100644 (file)
@@ -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;
 }
 
 /*