[PATCH 2/6] nvme-ioctl: use common type for user data addresses

Nilay Shroff nilay at linux.ibm.com
Tue Feb 25 06:29:59 PST 2025



On 2/24/25 11:51 PM, Keith Busch wrote:
> From: Keith Busch <kbusch at kernel.org>
> 
> The data type is represented as a u64, but the metadata type as a __user
> void *. These two fields represent the same thing, so treating them so
> differently looks a bit odd. Just pick one consistent type of
> representation.
> 
> Signed-off-by: Keith Busch <kbusch at kernel.org>
> ---
>  drivers/nvme/host/ioctl.c | 30 ++++++++++++++----------------
>  1 file changed, 14 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/nvme/host/ioctl.c b/drivers/nvme/host/ioctl.c
> index a3082414c7714..f1233a280d3b3 100644
> --- a/drivers/nvme/host/ioctl.c
> +++ b/drivers/nvme/host/ioctl.c
> @@ -114,7 +114,7 @@ static struct request *nvme_alloc_user_request(struct request_queue *q,
>  }
>  
>  static int nvme_map_user_request(struct request *req, u64 ubuffer,
> -		unsigned bufflen, void __user *meta_buffer, unsigned meta_len,
> +		unsigned bufflen, u64 meta_buffer, unsigned meta_len,
>  		struct io_uring_cmd *ioucmd, unsigned int flags)
>  {
>  	struct request_queue *q = req->q;
> @@ -161,7 +161,8 @@ static int nvme_map_user_request(struct request *req, u64 ubuffer,
>  		bio_set_dev(bio, bdev);
>  
>  	if (has_metadata) {
> -		ret = blk_rq_integrity_map_user(req, meta_buffer, meta_len);
> +		ret = blk_rq_integrity_map_user(req,
> +				nvme_to_user_ptr(meta_buffer), meta_len);
>  		if (ret)
>  			goto out_unmap;
>  	}
As we're stripping __user, for readability, can we name it as "umeta_buffer" or 
"user_meta_buffer"? The regular user data buffer is already named as "ubuffer". 
Otherwise this is good.

Thanks,
--Nilay




More information about the Linux-nvme mailing list