io_uring/rw.c:299 io_prep_rw() error: uninitialized symbol 'ret'.
PATCH 43/57 io_uring/rw.c:299 io_prep_rw() error: uninitialized symbol 'ret'.
tree: https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git for-6.15/io_uring head: 047fa0ba8f1bed6b1c5d88e31c4fd187de16dbc1 commit: 61ed48b5fc63d1c6d9c3eb59ed2b46a2cbfc6039 [43/57] io_uring/rw: open code io_prep_rw_setup() config: i386-randconfig-141-20250226 (https://download.01.org/0day-ci/archive/20250227/[email protected]/config) compiler: clang version 19.1.7 (https://github.com/llvm/llvm-project cd708029e0b2869e80abe31ddb175f7c35361f90)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]> | Reported-by: Dan Carpenter <[email protected]> | Closes: https://lore.kernel.org/r/[email protected]/
smatch warnings:io_uring/rw.c:299 io_prep_rw() error: uninitialized symbol 'ret'.
vim +/ret +299 io_uring/rw.c
a9165b83c1937e Jens Axboe 2024-03-18 248 static int io_prep_rw(struct io_kiocb *req, const struct io_uring_sqe *sqe,
a9165b83c1937e Jens Axboe 2024-03-18 249 int ddir, bool do_import)
f3b44f92e59a80 Jens Axboe 2022-06-13 250 {
f2ccb5aed7bce1 Stefan Metzmacher 2022-08-11 251 struct io_rw *rw = io_kiocb_to_cmd(req, struct io_rw);
f3b44f92e59a80 Jens Axboe 2022-06-13 252 unsigned ioprio;
59a7d12a7fb5ab Anuj Gupta 2024-11-28 253 u64 attr_type_mask;
f3b44f92e59a80 Jens Axboe 2022-06-13 254 int ret;
f3b44f92e59a80 Jens Axboe 2022-06-13 255
c72282dd865ee6 Pavel Begunkov 2025-02-24 256 if (io_rw_alloc_async(req))
c72282dd865ee6 Pavel Begunkov 2025-02-24 257 return -ENOMEM;
c72282dd865ee6 Pavel Begunkov 2025-02-24 258
f3b44f92e59a80 Jens Axboe 2022-06-13 259 rw->kiocb.ki_pos = READ_ONCE(sqe->off);
f3b44f92e59a80 Jens Axboe 2022-06-13 260 /* used for fixed read/write too - just read unconditionally */
f3b44f92e59a80 Jens Axboe 2022-06-13 261 req->buf_index = READ_ONCE(sqe->buf_index);
f3b44f92e59a80 Jens Axboe 2022-06-13 262
f3b44f92e59a80 Jens Axboe 2022-06-13 263 ioprio = READ_ONCE(sqe->ioprio);
f3b44f92e59a80 Jens Axboe 2022-06-13 264 if (ioprio) {
f3b44f92e59a80 Jens Axboe 2022-06-13 265 ret = ioprio_check_cap(ioprio);
f3b44f92e59a80 Jens Axboe 2022-06-13 266 if (ret)
f3b44f92e59a80 Jens Axboe 2022-06-13 267 return ret;
f3b44f92e59a80 Jens Axboe 2022-06-13 268
f3b44f92e59a80 Jens Axboe 2022-06-13 269 rw->kiocb.ki_ioprio = ioprio;
f3b44f92e59a80 Jens Axboe 2022-06-13 270 } else {
f3b44f92e59a80 Jens Axboe 2022-06-13 271 rw->kiocb.ki_ioprio = get_current_ioprio();
f3b44f92e59a80 Jens Axboe 2022-06-13 272 }
099ada2c87260e Jens Axboe 2023-07-08 273 rw->kiocb.dio_complete = NULL;
59a7d12a7fb5ab Anuj Gupta 2024-11-28 274 rw->kiocb.ki_flags = 0;
f3b44f92e59a80 Jens Axboe 2022-06-13 275
f3b44f92e59a80 Jens Axboe 2022-06-13 276 rw->addr = READ_ONCE(sqe->addr);
f3b44f92e59a80 Jens Axboe 2022-06-13 277 rw->len = READ_ONCE(sqe->len);
f3b44f92e59a80 Jens Axboe 2022-06-13 278 rw->flags = READ_ONCE(sqe->rw_flags);
59a7d12a7fb5ab Anuj Gupta 2024-11-28 279
61ed48b5fc63d1 Pavel Begunkov 2025-02-24 280 if (do_import && !io_do_buffer_select(req)) {
61ed48b5fc63d1 Pavel Begunkov 2025-02-24 281 struct io_async_rw *io = req->async_data;
61ed48b5fc63d1 Pavel Begunkov 2025-02-24 282
61ed48b5fc63d1 Pavel Begunkov 2025-02-24 283 ret = io_import_rw_buffer(ddir, req, io, 0);
59a7d12a7fb5ab Anuj Gupta 2024-11-28 284 if (unlikely(ret))
59a7d12a7fb5ab Anuj Gupta 2024-11-28 285 return ret;
61ed48b5fc63d1 Pavel Begunkov 2025-02-24 286 }
59a7d12a7fb5ab Anuj Gupta 2024-11-28 287
59a7d12a7fb5ab Anuj Gupta 2024-11-28 288 attr_type_mask = READ_ONCE(sqe->attr_type_mask);
59a7d12a7fb5ab Anuj Gupta 2024-11-28 289 if (attr_type_mask) {
59a7d12a7fb5ab Anuj Gupta 2024-11-28 290 u64 attr_ptr;
59a7d12a7fb5ab Anuj Gupta 2024-11-28 291
59a7d12a7fb5ab Anuj Gupta 2024-11-28 292 /* only PI attribute is supported currently */
59a7d12a7fb5ab Anuj Gupta 2024-11-28 293 if (attr_type_mask != IORING_RW_ATTR_FLAG_PI)
59a7d12a7fb5ab Anuj Gupta 2024-11-28 294 return -EINVAL;
59a7d12a7fb5ab Anuj Gupta 2024-11-28 295
59a7d12a7fb5ab Anuj Gupta 2024-11-28 296 attr_ptr = READ_ONCE(sqe->attr_ptr);
59a7d12a7fb5ab Anuj Gupta 2024-11-28 297 ret = io_prep_rw_pi(req, rw, ddir, attr_ptr, attr_type_mask);
59a7d12a7fb5ab Anuj Gupta 2024-11-28 298 }59a7d12a7fb5ab Anuj Gupta 2024-11-28 @299 return ret;
Smatch is concerned that we could hit all three else statements.
a9165b83c1937e Jens Axboe 2024-03-18 300 }
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
Quoted 6 lines · Dan Carpenter
tree: https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git for-6.15/io_uring head: 047fa0ba8f1bed6b1c5d88e31c4fd187de16dbc1 commit: 61ed48b5fc63d1c6d9c3eb59ed2b46a2cbfc6039 [43/57] io_uring/rw: open code io_prep_rw_setup() config: i386-randconfig-141-20250226 (https://download.01.org/0day-ci/archive/20250227/[email protected]/config) compiler: clang version 19.1.7 (https://github.com/llvm/llvm-project cd708029e0b2869e80abe31ddb175f7c35361f90)
Quoted 8 lines
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]> | Reported-by: Dan Carpenter <[email protected]> | Closes: https://lore.kernel.org/r/[email protected]/smatch warnings:
io_uring/rw.c:299io_prep_rw()error: uninitialized symbol 'ret'.
Thanks for letting know
Signature · 1 line
Pavel Begunkov
Quoted 13 lines · Pavel Begunkov
Quoted 12 lines · Dan Carpenter
tree: https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git for-6.15/io_uring
head:047fa0ba8f1bed6b1c5d88e31c4fd187de16dbc1
commit:61ed48b5fc63d1c6d9c3eb59ed2b46a2cbfc6039[43/57]io_uring/rw: open codeio_prep_rw_setup()
config: i386-randconfig-141-20250226 (https://download.01.org/0day-ci/archive/20250227/[email protected]/config)
compiler: clang version 19.1.7 (https://github.com/llvm/llvm-projectcd708029e0b2869e80abe31ddb175f7c35361f90)If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]> | Reported-by: Dan Carpenter <[email protected]> | Closes: https://lore.kernel.org/r/[email protected]/
Quoted 4 lines
Quoted 2 lines
smatch warnings:
io_uring/rw.c:299io_prep_rw()error: uninitialized symbol 'ret'.Thanks for letting know
Folded in a fix.
Signature · 1 line
Jens Axboe