* [PATCH -next] ublk: Fix signedness bug returning warning
@ 2023-08-10 8:48 Li Zetao
2023-08-10 9:17 ` Ming Lei
2023-08-10 13:20 ` Jens Axboe
0 siblings, 2 replies; 3+ messages in thread
From: Li Zetao @ 2023-08-10 8:48 UTC (permalink / raw)
To: ming.lei, axboe, a.hindborg; +Cc: lizetao1, linux-block
There are two warnings reported by smatch:
drivers/block/ublk_drv.c:445 ublk_setup_iod_zoned() warn:
signedness bug returning '(-95)'
drivers/block/ublk_drv.c:963 ublk_setup_iod() warn:
signedness bug returning '(-5)'
The type of "blk_status_t" is either be a u32 or u8, but this two
functions return a negative value when not supported or failed. Use
the error code of the blk module to fix these warnings.
Fixes: 29802d7ca33b ("ublk: enable zoned storage support")
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Closes: https://lore.kernel.org/r/202308100201.TCRhgdvN-lkp@intel.com/
Signed-off-by: Li Zetao <lizetao1@huawei.com>
---
drivers/block/ublk_drv.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/block/ublk_drv.c b/drivers/block/ublk_drv.c
index 85a81ee556d5..ef1760b3d8b5 100644
--- a/drivers/block/ublk_drv.c
+++ b/drivers/block/ublk_drv.c
@@ -442,7 +442,7 @@ static int ublk_revalidate_disk_zones(struct ublk_device *ub)
static blk_status_t ublk_setup_iod_zoned(struct ublk_queue *ubq,
struct request *req)
{
- return -EOPNOTSUPP;
+ return BLK_STS_NOTSUPP;
}
#endif
@@ -960,7 +960,7 @@ static blk_status_t ublk_setup_iod(struct ublk_queue *ubq, struct request *req)
if (!ublk_queue_is_zoned(ubq) &&
(op_is_zone_mgmt(op) || op == REQ_OP_ZONE_APPEND))
- return -EIO;
+ return BLK_STS_IOERR;
switch (req_op(req)) {
case REQ_OP_READ:
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH -next] ublk: Fix signedness bug returning warning
2023-08-10 8:48 [PATCH -next] ublk: Fix signedness bug returning warning Li Zetao
@ 2023-08-10 9:17 ` Ming Lei
2023-08-10 13:20 ` Jens Axboe
1 sibling, 0 replies; 3+ messages in thread
From: Ming Lei @ 2023-08-10 9:17 UTC (permalink / raw)
To: Li Zetao; +Cc: axboe, a.hindborg, linux-block
On Thu, Aug 10, 2023 at 04:48:36PM +0800, Li Zetao wrote:
> There are two warnings reported by smatch:
>
> drivers/block/ublk_drv.c:445 ublk_setup_iod_zoned() warn:
> signedness bug returning '(-95)'
> drivers/block/ublk_drv.c:963 ublk_setup_iod() warn:
> signedness bug returning '(-5)'
>
> The type of "blk_status_t" is either be a u32 or u8, but this two
> functions return a negative value when not supported or failed. Use
> the error code of the blk module to fix these warnings.
>
> Fixes: 29802d7ca33b ("ublk: enable zoned storage support")
> Reported-by: kernel test robot <lkp@intel.com>
> Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
> Closes: https://lore.kernel.org/r/202308100201.TCRhgdvN-lkp@intel.com/
> Signed-off-by: Li Zetao <lizetao1@huawei.com>
Reviewed-by: Ming Lei <ming.lei@redhat.com>
thanks,
Ming
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH -next] ublk: Fix signedness bug returning warning
2023-08-10 8:48 [PATCH -next] ublk: Fix signedness bug returning warning Li Zetao
2023-08-10 9:17 ` Ming Lei
@ 2023-08-10 13:20 ` Jens Axboe
1 sibling, 0 replies; 3+ messages in thread
From: Jens Axboe @ 2023-08-10 13:20 UTC (permalink / raw)
To: ming.lei, a.hindborg, Li Zetao; +Cc: linux-block
On Thu, 10 Aug 2023 16:48:36 +0800, Li Zetao wrote:
> There are two warnings reported by smatch:
>
> drivers/block/ublk_drv.c:445 ublk_setup_iod_zoned() warn:
> signedness bug returning '(-95)'
> drivers/block/ublk_drv.c:963 ublk_setup_iod() warn:
> signedness bug returning '(-5)'
>
> [...]
Applied, thanks!
[1/1] ublk: Fix signedness bug returning warning
commit: c8659bbb15cd42577a9b16a23b527436b028c8b2
Best regards,
--
Jens Axboe
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-08-10 13:20 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-10 8:48 [PATCH -next] ublk: Fix signedness bug returning warning Li Zetao
2023-08-10 9:17 ` Ming Lei
2023-08-10 13:20 ` Jens Axboe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox