Re: [linux-lvm] Re: *** ANNOUNCEMENT *** LVM 0.9.1 beta1 available at www.sistina.com

From: Anton Blanchard (anton@linuxcare.com.au)
Date: Sat Jan 13 2001 - 20:23:03 EST


 
> The longs are the biggest problem AFAICS.
> long is 64bit on sparc64 and 32bit on sparc32...

Embedding pointers in ioctls is much worse. When this happens we basically
end up duplicating the ioctl parsing code (this code courtesy of jakub's
sharp mind, but it would be nice not to require this :)

Anton

        case VG_CREATE:
                v = kmalloc(sizeof(vg_t), GFP_KERNEL);
                if (!v) return -ENOMEM;
                if (copy_from_user(v, (void *)arg, (long)&((vg32_t *)0)->proc) ||
                    __get_user(v->proc, &((vg32_t *)arg)->proc)) {
                        kfree(v);
                        return -EFAULT;
                }
                karg = v;
                memset(v->pv, 0, sizeof(v->pv) + sizeof(v->lv));
                if (v->pv_max > ABS_MAX_PV || v->lv_max > ABS_MAX_LV)
                        return -EPERM;
                for (i = 0; i < v->pv_max; i++) {
                        err = __get_user(ptr, &((vg32_t *)arg)->pv[i]);
                        if (err) break;
                        if (ptr) {
                                v->pv[i] = kmalloc(sizeof(pv_t), GFP_KERNEL);
                                if (!v->pv[i]) {
                                        err = -ENOMEM;
                                        break;
                                }
                                err = copy_from_user(v->pv[i], (void *)A(ptr), sizeof(pv32_t) - 8);
                                if (err) {
                                        err = -EFAULT;
                                        break;
                                }
                                v->pv[i]->pe = NULL; v->pv[i]->inode = NULL;
                        }
                }
                if (!err) {
                        for (i = 0; i < v->lv_max; i++) {
                                err = __get_user(ptr, &((vg32_t *)arg)->lv[i]);
                                if (err) break;
                                if (ptr) {
                                        v->lv[i] = get_lv_t(ptr, &err);
                                        if (err) break;
                                }
                        }
                }
                break;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Mon Jan 15 2001 - 21:00:38 EST