Eric Biggers 9c2010bccc dm-integrity: check mac_size against HASH_MAX_DIGESTSIZE in sb_mac()
sb_mac() verifies that the superblock + MAC don't exceed 512 bytes.
Because the superblock is currently 64 bytes, this really verifies
mac_size <= 448.  This confuses smatch into thinking that mac_size may
be as large as 448, which is inconsistent with the later code that
assumes the MAC fits in a buffer of size HASH_MAX_DIGESTSIZE (64).

In fact mac_size <= HASH_MAX_DIGESTSIZE is guaranteed by the crypto API,
as that is the whole point of HASH_MAX_DIGESTSIZE.  But, let's be
defensive and explicitly check for this.  This suppresses the false
positive smatch warning.  It does not fix an actual bug.

Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Closes: https://lore.kernel.org/r/202409061401.44rtN1bh-lkp@intel.com/
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
2024-09-11 14:04:41 +02:00
..
2024-04-01 11:53:37 -06:00
2024-06-26 11:32:39 -04:00
2024-05-09 09:10:58 -04:00
2023-02-14 14:23:07 -05:00
2023-02-14 14:23:07 -05:00
2024-02-20 14:22:51 -05:00
2024-06-26 11:32:39 -04:00
2024-02-20 14:22:51 -05:00
2023-02-14 14:23:07 -05:00
2024-09-02 11:41:11 +02:00
2023-02-14 14:23:06 -05:00
2024-07-05 00:42:04 -06:00
2024-07-22 11:32:05 -07:00
2024-03-06 08:59:53 -08:00