From: Ankit Kumar <ankit.kumar@samsung.com>
To: axboe@kernel.dk
Cc: fio@vger.kernel.org, vincentfu@gmail.com,
Ankit Kumar <ankit.kumar@samsung.com>
Subject: [PATCH 1/1] engines/io_uring: fix coverity issue
Date: Tue, 16 May 2023 17:47:17 +0530 [thread overview]
Message-ID: <20230516121717.28508-2-ankit.kumar@samsung.com> (raw)
In-Reply-To: <20230516121717.28508-1-ankit.kumar@samsung.com>
*** CID 455020: Integer handling issues (BAD_SHIFT)
/engines/io_uring.c: 1201 in fio_ioring_cmd_open_file()
In expression "1 << data->lba_shift", left shifting by more than 31 bits
has undefined behavior. The shift amount, "data->lba_shift", is 4294967295
Fixes: 345fa8f ("engines/io_uring_cmd: add extended LBA support")
Signed-off-by: Ankit Kumar <ankit.kumar@samsung.com>
---
engines/io_uring.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/engines/io_uring.c b/engines/io_uring.c
index 90e5a856..ff64fc9f 100644
--- a/engines/io_uring.c
+++ b/engines/io_uring.c
@@ -1198,7 +1198,8 @@ static int fio_ioring_cmd_open_file(struct thread_data *td, struct fio_file *f)
FILE_SET_ENG_DATA(f, data);
}
- lba_size = data->lba_ext ? data->lba_ext : (1 << data->lba_shift);
+ assert(data->lba_shift < 32);
+ lba_size = data->lba_ext ? data->lba_ext : (1U << data->lba_shift);
for_each_rw_ddir(ddir) {
if (td->o.min_bs[ddir] % lba_size ||
--
2.25.1
next prev parent reply other threads:[~2023-05-16 6:59 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20230516065713epcas5p213f17bd22ff9c5256940dc420e6c07c9@epcas5p2.samsung.com>
2023-05-16 12:17 ` [PATCH 0/1] fix coverity issue Ankit Kumar
[not found] ` <CGME20230516065714epcas5p356762595641f6e8c102c8346a1681747@epcas5p3.samsung.com>
2023-05-16 12:17 ` Ankit Kumar [this message]
2023-05-16 15:02 ` Jens Axboe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230516121717.28508-2-ankit.kumar@samsung.com \
--to=ankit.kumar@samsung.com \
--cc=axboe@kernel.dk \
--cc=fio@vger.kernel.org \
--cc=vincentfu@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.