virtio_blk: Fix signedness bug in virtblk_prep_rq()
authorRafael Mendonca <rafaelmendsr@gmail.com>
Fri, 21 Oct 2022 20:41:26 +0000 (17:41 -0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 12 Jan 2023 11:02:54 +0000 (12:02 +0100)
commitbff553de2c372ef088666d89465cc60a3e2ef12d
treec9383eb8a6a009be1d0c3c0ce838764f4fcf9175
parent569b4f8fb02e212353fbe7ae3d4dacd3016217d0
virtio_blk: Fix signedness bug in virtblk_prep_rq()

[ Upstream commit a26116c1e74028914f281851488546c91cbae57d ]

The virtblk_map_data() function returns negative error codes, however, the
'nents' field of vbr->sg_table is an unsigned int, which causes the error
handling not to work correctly.

Cc: stable@vger.kernel.org
Fixes: 0e9911fa768f ("virtio-blk: support mq_ops->queue_rqs()")
Signed-off-by: Rafael Mendonca <rafaelmendsr@gmail.com>
Message-Id: <20221021204126.927603-1-rafaelmendsr@gmail.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
Reviewed-by: Suwan Kim <suwan.kim027@gmail.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/block/virtio_blk.c