[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200422080752.GA24916@lst.de>
Date: Wed, 22 Apr 2020 10:07:52 +0200
From: Christoph Hellwig <hch@....de>
To: Martijn Coenen <maco@...roid.com>
Cc: Christoph Hellwig <hch@....de>, Jens Axboe <axboe@...nel.dk>,
Ming Lei <ming.lei@...hat.com>,
Narayan Kamath <narayan@...gle.com>,
Zimuzo Ezeozue <zezeozue@...gle.com>, kernel-team@...roid.com,
linux-block <linux-block@...r.kernel.org>,
LKML <linux-kernel@...r.kernel.org>,
Martijn Coenen <maco@...gle.com>,
Bart Van Assche <bvanassche@....org>,
Chaitanya Kulkarni <Chaitanya.Kulkarni@....com>
Subject: Re: [PATCH 4/4] loop: Add LOOP_SET_FD_AND_STATUS ioctl.
On Wed, Apr 22, 2020 at 10:06:17AM +0200, Martijn Coenen wrote:
> > line at the top of lo_compat_ioctl, and switches the LOOP_SET_STATUS
> > and LOOP_GET_STATUS case to it?
>
> Did you mean in regular lo_ioctl()?
Yes, sorry.
> eg something like this:
>
> @@ -1671,6 +1671,7 @@ static int lo_ioctl(struct block_device *bdev,
> fmode_t mode,
> unsigned int cmd, unsigned long arg)
> {
> struct loop_device *lo = bdev->bd_disk->private_data;
> + void __user *argp = (void __user *) arg;
> int err;
>
> switch (cmd) {
> @@ -1694,21 +1695,19 @@ static int lo_ioctl(struct block_device *bdev,
> fmode_t mode,
> case LOOP_SET_STATUS:
> err = -EPERM;
> if ((mode & FMODE_WRITE) || capable(CAP_SYS_ADMIN)) {
> - err = loop_set_status_old(lo,
> - (struct loop_info __user *)arg);
> + err = loop_set_status_old(lo, argp);
> }
> break;
> case LOOP_GET_STATUS:
> - return loop_get_status_old(lo, (struct loop_info __user *) arg);
> + return loop_get_status_old(lo, argp);
> case LOOP_SET_STATUS64:
> err = -EPERM;
> if ((mode & FMODE_WRITE) || capable(CAP_SYS_ADMIN)) {
> - err = loop_set_status64(lo,
> - (struct loop_info64 __user *) arg);
> + err = loop_set_status64(lo, argp);
> }
> break;
> case LOOP_GET_STATUS64:
> - return loop_get_status64(lo, (struct loop_info64 __user *) arg);
> + return loop_get_status64(lo, argp);
Exactly!
Powered by blists - more mailing lists