Skip to contentSkip to conversation

fix coverity issue

PATCH Applied Ankit Kumar 2 participants 3 messages May 16, 2023 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): CGME20230516065713epcas5p213f17bd22ff9c5256940dc420e6c07c9@epcas5p2.samsung.com

#1 lore raw

cover fix coverity issue

This patch fixes the below mentioned coverity issue CID 455020: Integer handling issues (BAD_SHIFT) /engines/io_uring.c: 1201 in fio_ioring_cmd_open_file()

Fixes 345fa8f ("engines/io_uring_cmd: add extended LBA support")

Ankit Kumar (1):
engines/io_uring: fix coverity issue

 engines/io_uring.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
Signature · 1 line
2.25.1
#2 lore raw

PATCH 1/1 engines/io_uring: fix coverity issue

*** 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")
---
 engines/io_uring.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
engines/io_uring.c +2 -1
index 90e5a856..ff64fc9f 100644
@@ -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 ||
Signature · 1 line
2.25.1
Applied
#3 lore raw
In reply to Ankit Kumar
Quoted 10 lines · Ankit Kumar

This patch fixes the below mentioned coverity issue CID 455020: Integer handling issues (BAD_SHIFT) /engines/io_uring.c: 1201 in fio_ioring_cmd_open_file()

Fixes 345fa8f ("engines/io_uring_cmd: add extended LBA support")

Ankit Kumar (1):
engines/io_uring: fix coverity issue

[...]

Applied, thanks!

[1/1] engines/io_uring: fix coverity issue

      commit: be42eadd18fad2569dfc6517940db8bbe2469f6d

Best regards,

Signature · 1 line
Jens Axboe