]> git.baikalelectronics.ru Git - kernel.git/commit
dm ima: fix wrong length calculation for no_data string
authorThore Sommer <public@thson.de>
Tue, 25 Jan 2022 14:05:47 +0000 (15:05 +0100)
committerMike Snitzer <snitzer@redhat.com>
Tue, 22 Feb 2022 15:42:41 +0000 (10:42 -0500)
commit71f361776a2702b2a4aa9c82734aaa41472dfa2c
treeb4e9b792963a61d9175dc728576a58ce37e19090
parente1c2fb12a23cca953e81fccbf7037ca7cbab118e
dm ima: fix wrong length calculation for no_data string

All entries measured by dm ima are prefixed by a version string
(dm_version=N.N.N). When there is no data to measure, the entire buffer is
overwritten with a string containing the version string again and the
length of that string is added to the length of the version string.
The new length is now wrong because it contains the version string twice.

This caused entries like this:
dm_version=4.45.0;name=test,uuid=test;table_clear=no_data; \
\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00 \
current_device_capacity=204808;

Signed-off-by: Thore Sommer <public@thson.de>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
drivers/md/dm-ima.c