Skip to contentSkip to conversation

dm: add integrity target

bug report Dan Carpenter 2 participants 2 messages Mar 13, 2017 – Mar 15, 2017 Device mapper

lore
Share & tools
lore
#0 lore raw

Hello Mikulas Patocka,

The patch dfab77c854fc: "dm: add integrity target" from Jan 4, 2017, leads to the following static checker warning:

	drivers/md/dm-integrity.c:2653 dm_integrity_ctr()
	warn: always true condition '(ic->sb->log2_interleave_sectors != -1) => (0-255 != (-1))'

drivers/md/dm-integrity.c
2647 if (le16_to_cpu(ic->sb->integrity_tag_size) != ic->tag_size) {

  2648                  r = -EINVAL;
  2649                  ti->error = "Invalid tag size";
  2650                  goto bad;
  2651          }
  2652          /* make sure that ti->max_io_len doesn't overflow */
  2653          if (ic->sb->log2_interleave_sectors != -1 && (ic->sb->log2_interleave_sectors < MIN_INTERLEAVE_SECTORS || ic->sb->log2_interleave_sectors > MAX_INTERLEAVE_SECTORS)) {
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Impossible! Also this line is really really really long so it doesn't even fit in my email client. It's like a million characters long.

  2654                  r = -EINVAL;
  2655                  ti->error = "Invalid interleave_sectors in the superblock";
  2656                  goto bad;

2657 }

regards,
dan carpenter

maintainer
#1 lore raw
Quoted 4 lines · Dan Carpenter

Hello Mikulas Patocka,

The patch dfab77c854fc: "dm: add integrity target" from Jan 4, 2017, leads to the following static checker warning:

Hi

I already removed this condition in my code. It comes from an old version where interleaving could be disabled and disabled interleaving was indicated by "-1". The current version always uses interleaving, so this condition is pointless.

Mikulas

Quoted 24 lines
	drivers/md/dm-integrity.c:2653 dm_integrity_ctr()
	warn: always true condition '(ic->sb->log2_interleave_sectors != -1) => (0-255 != (-1))'

drivers/md/dm-integrity.c
2647 if (le16_to_cpu(ic->sb->integrity_tag_size) != ic->tag_size) {

  2648                  r = -EINVAL;
  2649                  ti->error = "Invalid tag size";
  2650                  goto bad;
  2651          }
  2652          /* make sure that ti->max_io_len doesn't overflow */
  2653          if (ic->sb->log2_interleave_sectors != -1 && (ic->sb->log2_interleave_sectors < MIN_INTERLEAVE_SECTORS || ic->sb->log2_interleave_sectors > MAX_INTERLEAVE_SECTORS)) {
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Impossible! Also this line is really really really long so it doesn't even fit in my email client. It's like a million characters long.

  2654                  r = -EINVAL;
  2655                  ti->error = "Invalid interleave_sectors in the superblock";
  2656                  goto bad;

2657 }

regards,
dan carpenter