* [linux-next:master 12153/13432] drivers/md/dm-integrity.c:4559 dm_integrity_ctr() warn: impossible condition '(bi->tuple_size > ((1) << 12) / 2) => (0-255 > 2048)'
@ 2024-07-18 15:27 Dan Carpenter
0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2024-07-18 15:27 UTC (permalink / raw)
To: oe-kbuild, Mikulas Patocka
Cc: lkp, oe-kbuild-all, Linux Memory Management List, Mike Snitzer
tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head: 73399b58e5e5a1b28a04baf42e321cfcfc663c2f
commit: b40cdccafe29f2192807b44130cf5099337ebf8f [12153/13432] dm-integrity: introduce the Inline mode
config: i386-randconfig-141-20240718 (https://download.01.org/0day-ci/archive/20240718/202407182211.faX85HCP-lkp@intel.com/config)
compiler: clang version 18.1.5 (https://github.com/llvm/llvm-project 617a15a9eac96088ae5e9134248d8236e34b91b1)
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 <lkp@intel.com>
| Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
| Closes: https://lore.kernel.org/r/202407182211.faX85HCP-lkp@intel.com/
New smatch warnings:
drivers/md/dm-integrity.c:4559 dm_integrity_ctr() warn: impossible condition '(bi->tuple_size > ((1) << 12) / 2) => (0-255 > 2048)'
vim +4559 drivers/md/dm-integrity.c
b40cdccafe29f2 Mikulas Patocka 2024-07-10 4525 if (ic->mode == 'I') {
b40cdccafe29f2 Mikulas Patocka 2024-07-10 4526 struct blk_integrity *bi;
bi->tuple_size is a u8
b40cdccafe29f2 Mikulas Patocka 2024-07-10 4527 if (ic->meta_dev) {
b40cdccafe29f2 Mikulas Patocka 2024-07-10 4528 r = -EINVAL;
b40cdccafe29f2 Mikulas Patocka 2024-07-10 4529 ti->error = "Metadata device not supported in inline mode";
b40cdccafe29f2 Mikulas Patocka 2024-07-10 4530 goto bad;
b40cdccafe29f2 Mikulas Patocka 2024-07-10 4531 }
b40cdccafe29f2 Mikulas Patocka 2024-07-10 4532 if (!ic->internal_hash_alg.alg_string) {
b40cdccafe29f2 Mikulas Patocka 2024-07-10 4533 r = -EINVAL;
b40cdccafe29f2 Mikulas Patocka 2024-07-10 4534 ti->error = "Internal hash not set in inline mode";
b40cdccafe29f2 Mikulas Patocka 2024-07-10 4535 goto bad;
b40cdccafe29f2 Mikulas Patocka 2024-07-10 4536 }
b40cdccafe29f2 Mikulas Patocka 2024-07-10 4537 if (ic->journal_crypt_alg.alg_string || ic->journal_mac_alg.alg_string) {
b40cdccafe29f2 Mikulas Patocka 2024-07-10 4538 r = -EINVAL;
b40cdccafe29f2 Mikulas Patocka 2024-07-10 4539 ti->error = "Journal crypt not supported in inline mode";
b40cdccafe29f2 Mikulas Patocka 2024-07-10 4540 goto bad;
b40cdccafe29f2 Mikulas Patocka 2024-07-10 4541 }
b40cdccafe29f2 Mikulas Patocka 2024-07-10 4542 if (ic->discard) {
b40cdccafe29f2 Mikulas Patocka 2024-07-10 4543 r = -EINVAL;
b40cdccafe29f2 Mikulas Patocka 2024-07-10 4544 ti->error = "Discards not supported in inline mode";
b40cdccafe29f2 Mikulas Patocka 2024-07-10 4545 goto bad;
b40cdccafe29f2 Mikulas Patocka 2024-07-10 4546 }
b40cdccafe29f2 Mikulas Patocka 2024-07-10 4547 bi = blk_get_integrity(ic->dev->bdev->bd_disk);
b40cdccafe29f2 Mikulas Patocka 2024-07-10 4548 if (!bi || bi->csum_type != BLK_INTEGRITY_CSUM_NONE) {
b40cdccafe29f2 Mikulas Patocka 2024-07-10 4549 r = -EINVAL;
b40cdccafe29f2 Mikulas Patocka 2024-07-10 4550 ti->error = "Integrity profile not supported";
b40cdccafe29f2 Mikulas Patocka 2024-07-10 4551 goto bad;
b40cdccafe29f2 Mikulas Patocka 2024-07-10 4552 }
b40cdccafe29f2 Mikulas Patocka 2024-07-10 4553 /*printk("tag_size: %u, tuple_size: %u\n", bi->tag_size, bi->tuple_size);*/
b40cdccafe29f2 Mikulas Patocka 2024-07-10 4554 if (bi->tuple_size < ic->tag_size) {
b40cdccafe29f2 Mikulas Patocka 2024-07-10 4555 r = -EINVAL;
b40cdccafe29f2 Mikulas Patocka 2024-07-10 4556 ti->error = "The integrity profile is smaller than tag size";
b40cdccafe29f2 Mikulas Patocka 2024-07-10 4557 goto bad;
b40cdccafe29f2 Mikulas Patocka 2024-07-10 4558 }
b40cdccafe29f2 Mikulas Patocka 2024-07-10 @4559 if (bi->tuple_size > PAGE_SIZE / 2) {
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
PAGE_SIZE is never going to be less than 4k and 255 is lot less than
PAGE_SIZE / 2. Was something else intended here?
b40cdccafe29f2 Mikulas Patocka 2024-07-10 4560 r = -EINVAL;
b40cdccafe29f2 Mikulas Patocka 2024-07-10 4561 ti->error = "Too big tuple size";
b40cdccafe29f2 Mikulas Patocka 2024-07-10 4562 goto bad;
b40cdccafe29f2 Mikulas Patocka 2024-07-10 4563 }
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2024-07-18 15:28 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-07-18 15:27 [linux-next:master 12153/13432] drivers/md/dm-integrity.c:4559 dm_integrity_ctr() warn: impossible condition '(bi->tuple_size > ((1) << 12) / 2) => (0-255 > 2048)' Dan Carpenter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox