md: get_disk_info(): Don't convert between signed and unsigned and back.
The current code copies a signed int from user space, converts it to unsigned and passes the unsigned value to find_rdev_nr() which expects a signed value. Simply pass the signed value from user space directly. Signed-off-by: Andre Noll <maan@systemlinux.org> Signed-off-by: Neil Brown <neilb@suse.de>
This commit is contained in:
parent
80fab1d77b
commit
26ef379f53
|
@ -4186,15 +4186,12 @@ out:
|
||||||
static int get_disk_info(mddev_t * mddev, void __user * arg)
|
static int get_disk_info(mddev_t * mddev, void __user * arg)
|
||||||
{
|
{
|
||||||
mdu_disk_info_t info;
|
mdu_disk_info_t info;
|
||||||
unsigned int nr;
|
|
||||||
mdk_rdev_t *rdev;
|
mdk_rdev_t *rdev;
|
||||||
|
|
||||||
if (copy_from_user(&info, arg, sizeof(info)))
|
if (copy_from_user(&info, arg, sizeof(info)))
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
|
|
||||||
nr = info.number;
|
rdev = find_rdev_nr(mddev, info.number);
|
||||||
|
|
||||||
rdev = find_rdev_nr(mddev, nr);
|
|
||||||
if (rdev) {
|
if (rdev) {
|
||||||
info.major = MAJOR(rdev->bdev->bd_dev);
|
info.major = MAJOR(rdev->bdev->bd_dev);
|
||||||
info.minor = MINOR(rdev->bdev->bd_dev);
|
info.minor = MINOR(rdev->bdev->bd_dev);
|
||||||
|
|
Loading…
Reference in New Issue