From: Dan Carpenter <dan.carpenter@linaro.org>
To: oe-kbuild@lists.linux.dev, Mikulas Patocka <mpatocka@redhat.com>
Cc: lkp@intel.com, oe-kbuild-all@lists.linux.dev,
Linux Memory Management List <linux-mm@kvack.org>,
Mike Snitzer <snitzer@kernel.org>
Subject: [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)'
Date: Thu, 18 Jul 2024 10:27:55 -0500 [thread overview]
Message-ID: <70e61f94-d4c6-4ef6-9e72-d65017a745bd@suswa.mountain> (raw)
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
reply other threads:[~2024-07-18 15:28 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=70e61f94-d4c6-4ef6-9e72-d65017a745bd@suswa.mountain \
--to=dan.carpenter@linaro.org \
--cc=linux-mm@kvack.org \
--cc=lkp@intel.com \
--cc=mpatocka@redhat.com \
--cc=oe-kbuild-all@lists.linux.dev \
--cc=oe-kbuild@lists.linux.dev \
--cc=snitzer@kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox