lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ed3bcce8-ede4-f4a3-d0a3-91662d5aae4e@nvidia.com>
Date:   Mon, 25 Oct 2021 11:24:57 +0300
From:   Max Gurtovoy <mgurtovoy@...dia.com>
To:     "Michael S. Tsirkin" <mst@...hat.com>,
        <linux-kernel@...r.kernel.org>, Jens Axboe <axboe@...nel.dk>,
        Christoph Hellwig <hch@....de>
CC:     kernel test robot <lkp@...el.com>,
        Jason Wang <jasowang@...hat.com>,
        "Paolo Bonzini" <pbonzini@...hat.com>,
        Stefan Hajnoczi <stefanha@...hat.com>,
        Feng Li <lifeng1519@...il.com>,
        Israel Rukshin <israelr@...dia.com>,
        <virtualization@...ts.linux-foundation.org>,
        <linux-block@...r.kernel.org>
Subject: Re: [PATCH] virtio_blk: corrent types for status handling


On 10/25/2021 10:58 AM, Michael S. Tsirkin wrote:
> virtblk_setup_cmd returns blk_status_t in an int, callers then assign it
> back to a blk_status_t variable. blk_status_t is either u32 or (more
> typically) u8 so it works, but is inelegant and causes sparse warnings.
>
> Pass the status in blk_status_t in a consistent way.
>
> Reported-by: kernel test robot <lkp@...el.com>
> Fixes: b2c5221fd074 ("virtio-blk: avoid preallocating big SGL for data")
> Cc: Max Gurtovoy <mgurtovoy@...dia.com>
> Signed-off-by: Michael S. Tsirkin <mst@...hat.com>
> ---
>   drivers/block/virtio_blk.c | 14 ++++++++------
>   1 file changed, 8 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
> index c336d9bb9105..c7d05ff24084 100644
> --- a/drivers/block/virtio_blk.c
> +++ b/drivers/block/virtio_blk.c
> @@ -208,8 +208,9 @@ static void virtblk_cleanup_cmd(struct request *req)
>   		kfree(bvec_virt(&req->special_vec));
>   }
>   
> -static int virtblk_setup_cmd(struct virtio_device *vdev, struct request *req,
> -		struct virtblk_req *vbr)
> +static blk_status_t virtblk_setup_cmd(struct virtio_device *vdev,
> +				      struct request *req,
> +				      struct virtblk_req *vbr)
>   {
>   	bool unmap = false;
>   	u32 type;
> @@ -317,14 +318,15 @@ static blk_status_t virtio_queue_rq(struct blk_mq_hw_ctx *hctx,
>   	unsigned long flags;
>   	unsigned int num;
>   	int qid = hctx->queue_num;
> -	int err;
>   	bool notify = false;
> +	blk_status_t status;
> +	int err;
>   
>   	BUG_ON(req->nr_phys_segments + 2 > vblk->sg_elems);
>   
> -	err = virtblk_setup_cmd(vblk->vdev, req, vbr);
> -	if (unlikely(err))
> -		return err;
> +	status = virtblk_setup_cmd(vblk->vdev, req, vbr);
> +	if (unlikely(status))
> +		return status;
>   

Maybe we can compare the returned status to BLK_STS_OK. But I see we 
don't do it also in NVMe subsystem so I guess we can assume BLK_STS_OK 
== 0 forever.

Jens/Christoph, any thoughts on that ?


Anyway Looks good.

Thanks for the fix,

Reviewed-by: Max Gurtovoy <mgurtovoy@...dia.com>

>   	blk_mq_start_request(req);
>   

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ