* [bvanassche:block-small-segments 10/13] block/blk.h:343 bio_may_exceed_limits() error: we previously assumed 'bio->bi_io_vec' could be null (see line 340)
@ 2023-01-30 11:36 ` Dan Carpenter
0 siblings, 0 replies; 3+ messages in thread
From: kernel test robot @ 2023-01-29 12:21 UTC (permalink / raw)
To: oe-kbuild; +Cc: lkp, Dan Carpenter
BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
TO: Bart Van Assche <bvanassche@acm.org>
tree: https://github.com/bvanassche/linux block-small-segments
head: c776ad1c2e1e0afaefb3ef5f1710dc3886f5348f
commit: b91c4a42d14ad8bfd74387c10c8c21db9fb2b998 [10/13] block: Add support for filesystem requests and small segments
:::::: branch date: 35 hours ago
:::::: commit date: 35 hours ago
config: m68k-randconfig-m041-20230129 (https://download.01.org/0day-ci/archive/20230129/202301292052.ofpUPNlC-lkp@intel.com/config)
compiler: m68k-linux-gcc (GCC) 12.1.0
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.com>
smatch warnings:
block/blk.h:343 bio_may_exceed_limits() error: we previously assumed 'bio->bi_io_vec' could be null (see line 340)
vim +343 block/blk.h
83d016ac86428d Bart Van Assche 2018-01-17 308
3ad5cee5cd000d Christoph Hellwig 2020-03-24 309 ssize_t part_size_show(struct device *dev, struct device_attribute *attr,
3ad5cee5cd000d Christoph Hellwig 2020-03-24 310 char *buf);
3ad5cee5cd000d Christoph Hellwig 2020-03-24 311 ssize_t part_stat_show(struct device *dev, struct device_attribute *attr,
3ad5cee5cd000d Christoph Hellwig 2020-03-24 312 char *buf);
3ad5cee5cd000d Christoph Hellwig 2020-03-24 313 ssize_t part_inflight_show(struct device *dev, struct device_attribute *attr,
3ad5cee5cd000d Christoph Hellwig 2020-03-24 314 char *buf);
3ad5cee5cd000d Christoph Hellwig 2020-03-24 315 ssize_t part_fail_show(struct device *dev, struct device_attribute *attr,
3ad5cee5cd000d Christoph Hellwig 2020-03-24 316 char *buf);
3ad5cee5cd000d Christoph Hellwig 2020-03-24 317 ssize_t part_fail_store(struct device *dev, struct device_attribute *attr,
3ad5cee5cd000d Christoph Hellwig 2020-03-24 318 const char *buf, size_t count);
581d4e28d9195a Jens Axboe 2008-09-14 319 ssize_t part_timeout_show(struct device *, struct device_attribute *, char *);
581d4e28d9195a Jens Axboe 2008-09-14 320 ssize_t part_timeout_store(struct device *, struct device_attribute *,
581d4e28d9195a Jens Axboe 2008-09-14 321 const char *, size_t);
581d4e28d9195a Jens Axboe 2008-09-14 322
c55ddd9082f757 Christoph Hellwig 2022-07-27 323 static inline bool bio_may_exceed_limits(struct bio *bio,
aa261f20589d89 Bart Van Assche 2022-10-25 324 const struct queue_limits *lim)
abd45c159df5fc Jens Axboe 2021-10-13 325 {
abd45c159df5fc Jens Axboe 2021-10-13 326 switch (bio_op(bio)) {
abd45c159df5fc Jens Axboe 2021-10-13 327 case REQ_OP_DISCARD:
abd45c159df5fc Jens Axboe 2021-10-13 328 case REQ_OP_SECURE_ERASE:
abd45c159df5fc Jens Axboe 2021-10-13 329 case REQ_OP_WRITE_ZEROES:
abd45c159df5fc Jens Axboe 2021-10-13 330 return true; /* non-trivial splitting decisions */
abd45c159df5fc Jens Axboe 2021-10-13 331 default:
abd45c159df5fc Jens Axboe 2021-10-13 332 break;
abd45c159df5fc Jens Axboe 2021-10-13 333 }
abd45c159df5fc Jens Axboe 2021-10-13 334
abd45c159df5fc Jens Axboe 2021-10-13 335 /*
b91c4a42d14ad8 Bart Van Assche 2022-09-27 336 * Check whether bio splitting should be performed. This check may
b91c4a42d14ad8 Bart Van Assche 2022-09-27 337 * trigger the bio splitting code even if splitting is not necessary.
abd45c159df5fc Jens Axboe 2021-10-13 338 */
b91c4a42d14ad8 Bart Van Assche 2022-09-27 339 if (blk_queue_sub_page_limits(lim) &&
b91c4a42d14ad8 Bart Van Assche 2022-09-27 @340 bio->bi_io_vec && bio->bi_io_vec->bv_len > lim->max_segment_size)
b91c4a42d14ad8 Bart Van Assche 2022-09-27 341 return true;
c55ddd9082f757 Christoph Hellwig 2022-07-27 342 return lim->chunk_sectors || bio->bi_vcnt != 1 ||
abd45c159df5fc Jens Axboe 2021-10-13 @343 bio->bi_io_vec->bv_len + bio->bi_io_vec->bv_offset > PAGE_SIZE;
abd45c159df5fc Jens Axboe 2021-10-13 344 }
abd45c159df5fc Jens Axboe 2021-10-13 345
:::::: The code at line 343 was first introduced by commit
:::::: abd45c159df5fcb7ac820e2825dac85de7c01c21 block: handle fast path of bio splitting inline
:::::: TO: Jens Axboe <axboe@kernel.dk>
:::::: CC: Jens Axboe <axboe@kernel.dk>
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests
^ permalink raw reply [flat|nested] 3+ messages in thread
* [bvanassche:block-small-segments 10/13] block/blk.h:343 bio_may_exceed_limits() error: we previously assumed 'bio->bi_io_vec' could be null (see line 340)
@ 2023-01-30 11:36 ` Dan Carpenter
0 siblings, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2023-01-30 11:36 UTC (permalink / raw)
To: oe-kbuild, Bart Van Assche; +Cc: lkp, oe-kbuild-all
tree: https://github.com/bvanassche/linux block-small-segments
head: c776ad1c2e1e0afaefb3ef5f1710dc3886f5348f
commit: b91c4a42d14ad8bfd74387c10c8c21db9fb2b998 [10/13] block: Add support for filesystem requests and small segments
config: m68k-randconfig-m041-20230129 (https://download.01.org/0day-ci/archive/20230129/202301292052.ofpUPNlC-lkp@intel.com/config)
compiler: m68k-linux-gcc (GCC) 12.1.0
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.com>
smatch warnings:
block/blk.h:343 bio_may_exceed_limits() error: we previously assumed 'bio->bi_io_vec' could be null (see line 340)
vim +343 block/blk.h
c55ddd9082f757 Christoph Hellwig 2022-07-27 323 static inline bool bio_may_exceed_limits(struct bio *bio,
aa261f20589d89 Bart Van Assche 2022-10-25 324 const struct queue_limits *lim)
abd45c159df5fc Jens Axboe 2021-10-13 325 {
abd45c159df5fc Jens Axboe 2021-10-13 326 switch (bio_op(bio)) {
abd45c159df5fc Jens Axboe 2021-10-13 327 case REQ_OP_DISCARD:
abd45c159df5fc Jens Axboe 2021-10-13 328 case REQ_OP_SECURE_ERASE:
abd45c159df5fc Jens Axboe 2021-10-13 329 case REQ_OP_WRITE_ZEROES:
abd45c159df5fc Jens Axboe 2021-10-13 330 return true; /* non-trivial splitting decisions */
abd45c159df5fc Jens Axboe 2021-10-13 331 default:
abd45c159df5fc Jens Axboe 2021-10-13 332 break;
abd45c159df5fc Jens Axboe 2021-10-13 333 }
abd45c159df5fc Jens Axboe 2021-10-13 334
abd45c159df5fc Jens Axboe 2021-10-13 335 /*
b91c4a42d14ad8 Bart Van Assche 2022-09-27 336 * Check whether bio splitting should be performed. This check may
b91c4a42d14ad8 Bart Van Assche 2022-09-27 337 * trigger the bio splitting code even if splitting is not necessary.
abd45c159df5fc Jens Axboe 2021-10-13 338 */
b91c4a42d14ad8 Bart Van Assche 2022-09-27 339 if (blk_queue_sub_page_limits(lim) &&
b91c4a42d14ad8 Bart Van Assche 2022-09-27 @340 bio->bi_io_vec && bio->bi_io_vec->bv_len > lim->max_segment_size)
^^^^^^^^^^^^^^
Check for NULL
b91c4a42d14ad8 Bart Van Assche 2022-09-27 341 return true;
c55ddd9082f757 Christoph Hellwig 2022-07-27 342 return lim->chunk_sectors || bio->bi_vcnt != 1 ||
abd45c159df5fc Jens Axboe 2021-10-13 @343 bio->bi_io_vec->bv_len + bio->bi_io_vec->bv_offset > PAGE_SIZE;
^^^^^^^^^^^^^^^^
Unchecked dereference
abd45c159df5fc Jens Axboe 2021-10-13 344 }
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [bvanassche:block-small-segments 10/13] block/blk.h:343 bio_may_exceed_limits() error: we previously assumed 'bio->bi_io_vec' could be null (see line 340)
2023-01-30 11:36 ` Dan Carpenter
(?)
@ 2023-01-30 17:17 ` Bart Van Assche
-1 siblings, 0 replies; 3+ messages in thread
From: Bart Van Assche @ 2023-01-30 17:17 UTC (permalink / raw)
To: Dan Carpenter, oe-kbuild; +Cc: lkp, oe-kbuild-all
On 1/30/23 03:36, Dan Carpenter wrote:
> tree: https://github.com/bvanassche/linux block-small-segments
> head: c776ad1c2e1e0afaefb3ef5f1710dc3886f5348f
> commit: b91c4a42d14ad8bfd74387c10c8c21db9fb2b998 [10/13] block: Add support for filesystem requests and small segments
> config: m68k-randconfig-m041-20230129 (https://download.01.org/0day-ci/archive/20230129/202301292052.ofpUPNlC-lkp@intel.com/config)
> compiler: m68k-linux-gcc (GCC) 12.1.0
>
> If you fix the issue, kindly add following tag where applicable
> | Reported-by: kernel test robot <lkp@intel.com>
> | Reported-by: Dan Carpenter <error27@gmail.com>
>
> smatch warnings:
> block/blk.h:343 bio_may_exceed_limits() error: we previously assumed 'bio->bi_io_vec' could be null (see line 340)
>
> vim +343 block/blk.h
>
> c55ddd9082f757 Christoph Hellwig 2022-07-27 323 static inline bool bio_may_exceed_limits(struct bio *bio,
> aa261f20589d89 Bart Van Assche 2022-10-25 324 const struct queue_limits *lim)
> abd45c159df5fc Jens Axboe 2021-10-13 325 {
> abd45c159df5fc Jens Axboe 2021-10-13 326 switch (bio_op(bio)) {
> abd45c159df5fc Jens Axboe 2021-10-13 327 case REQ_OP_DISCARD:
> abd45c159df5fc Jens Axboe 2021-10-13 328 case REQ_OP_SECURE_ERASE:
> abd45c159df5fc Jens Axboe 2021-10-13 329 case REQ_OP_WRITE_ZEROES:
> abd45c159df5fc Jens Axboe 2021-10-13 330 return true; /* non-trivial splitting decisions */
> abd45c159df5fc Jens Axboe 2021-10-13 331 default:
> abd45c159df5fc Jens Axboe 2021-10-13 332 break;
> abd45c159df5fc Jens Axboe 2021-10-13 333 }
> abd45c159df5fc Jens Axboe 2021-10-13 334
> abd45c159df5fc Jens Axboe 2021-10-13 335 /*
> b91c4a42d14ad8 Bart Van Assche 2022-09-27 336 * Check whether bio splitting should be performed. This check may
> b91c4a42d14ad8 Bart Van Assche 2022-09-27 337 * trigger the bio splitting code even if splitting is not necessary.
> abd45c159df5fc Jens Axboe 2021-10-13 338 */
> b91c4a42d14ad8 Bart Van Assche 2022-09-27 339 if (blk_queue_sub_page_limits(lim) &&
> b91c4a42d14ad8 Bart Van Assche 2022-09-27 @340 bio->bi_io_vec && bio->bi_io_vec->bv_len > lim->max_segment_size)
> ^^^^^^^^^^^^^^
> Check for NULL
>
> b91c4a42d14ad8 Bart Van Assche 2022-09-27 341 return true;
> c55ddd9082f757 Christoph Hellwig 2022-07-27 342 return lim->chunk_sectors || bio->bi_vcnt != 1 ||
> abd45c159df5fc Jens Axboe 2021-10-13 @343 bio->bi_io_vec->bv_len + bio->bi_io_vec->bv_offset > PAGE_SIZE;
> ^^^^^^^^^^^^^^^^
> Unchecked dereference
>
> abd45c159df5fc Jens Axboe 2021-10-13 344 }
Hi Dan,
I think in this case the unchecked dereference is safe.
bio->bi_vcnt == 1 implies that bio->bi_io_vec is not NULL.
Thanks,
Bart.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-01-30 17:17 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-29 12:21 [bvanassche:block-small-segments 10/13] block/blk.h:343 bio_may_exceed_limits() error: we previously assumed 'bio->bi_io_vec' could be null (see line 340) kernel test robot
2023-01-30 11:36 ` Dan Carpenter
2023-01-30 17:17 ` Bart Van Assche
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.