]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Fix for NULL pointer dereference.
authorArtur Wojcik <artur.wojcik@intel.com>
Thu, 10 Dec 2009 19:03:39 +0000 (12:03 -0700)
committerDan Williams <dan.j.williams@intel.com>
Thu, 10 Dec 2009 19:03:39 +0000 (12:03 -0700)
Pointers '_dev' and '_disk' returned from call to function '_get_imsm_dev'
and '_get_imsm_disk' may be NULL and will be dereferenced at lines
2933 and 2934, respectively.

Signed-off-by: Artur Wojcik <artur.wojcik@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
super-intel.c

index 03dcbd5b83fdb280c726fbd07102b125452c55a3..49e938dd490fdde04eda234ed576206e116b0e9a 100644 (file)
@@ -2938,6 +2938,10 @@ static int add_to_super_imsm_volume(struct supertype *st, mdu_disk_info_t *dk,
                struct imsm_dev *_dev = __get_imsm_dev(mpb, 0);
                struct imsm_disk *_disk = __get_imsm_disk(mpb, dl->index);
 
+               if (!_dev || !_disk) {
+                       fprintf(stderr, Name ": BUG mpb setup error\n");
+                       return 1;
+               }
                *_dev = *dev;
                *_disk = dl->disk;
                sum = random32();