VServer 1.9.2 (patch-2.6.8.1-vs1.9.2.diff)
[linux-2.6.git] / drivers / md / dm-table.c
index 87df3e9..d189f85 100644 (file)
@@ -181,8 +181,8 @@ static int alloc_targets(struct dm_table *t, unsigned int num)
        /*
         * Allocate both the target array and offset array at once.
         */
-       n_highs = (sector_t *) dm_vcalloc(sizeof(struct dm_target) +
-                                         sizeof(sector_t), num);
+       n_highs = (sector_t *) dm_vcalloc(num, sizeof(struct dm_target) +
+                                         sizeof(sector_t));
        if (!n_highs)
                return -ENOMEM;
 
@@ -400,7 +400,7 @@ static int upgrade_mode(struct dm_dev *dd, int new_mode)
        struct dm_dev dd_copy;
        dev_t dev = dd->bdev->bd_dev;
 
-       memcpy(&dd_copy, dd, sizeof(dd_copy));
+       dd_copy = *dd;
 
        dd->mode |= new_mode;
        dd->bdev = NULL;
@@ -408,7 +408,7 @@ static int upgrade_mode(struct dm_dev *dd, int new_mode)
        if (!r)
                close_dev(&dd_copy);
        else
-               memcpy(dd, &dd_copy, sizeof(dd_copy));
+               *dd = dd_copy;
 
        return r;
 }