mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/1] dm-vdo: Refactor VDO_ASSERT usage in start_restoring_volume functions
@ 2025-09-08 22:24 Ivan Abramov
  2025-09-09 18:58 ` Matthew Sakai
  0 siblings, 1 reply; 3+ messages in thread
From: Ivan Abramov @ 2025-09-08 22:24 UTC (permalink / raw)
  To: Matthew Sakai; +Cc: Ivan Abramov, dm-devel, linux-kernel, lvc-project

There's an incorrect VDO_ASSERT macro usage in 
start_restoring volume_index() and start_restoring_volume_sub_index(),
since assert's return value is not used anywhere.

Thus, use VDO_ASSERT_LOG_ONLY macro in such cases.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Signed-off-by: Ivan Abramov <i.abramov@mt-integration.ru>
---
 drivers/md/dm-vdo/indexer/volume-index.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/md/dm-vdo/indexer/volume-index.c b/drivers/md/dm-vdo/indexer/volume-index.c
index 12f954a0c532..99608f14400a 100644
--- a/drivers/md/dm-vdo/indexer/volume-index.c
+++ b/drivers/md/dm-vdo/indexer/volume-index.c
@@ -832,11 +832,9 @@ static int start_restoring_volume_sub_index(struct volume_sub_index *sub_index,
 		decode_u32_le(buffer, &offset, &header.first_list);
 		decode_u32_le(buffer, &offset, &header.list_count);
 
-		result = VDO_ASSERT(offset == sizeof(buffer),
+		VDO_ASSERT_LOG_ONLY(offset == sizeof(buffer),
 				    "%zu bytes decoded of %zu expected", offset,
 				    sizeof(buffer));
-		if (result != VDO_SUCCESS)
-			result = UDS_CORRUPT_DATA;
 
 		if (memcmp(header.magic, MAGIC_START_5, MAGIC_SIZE) != 0) {
 			return vdo_log_warning_strerror(UDS_CORRUPT_DATA,
@@ -924,11 +922,9 @@ static int start_restoring_volume_index(struct volume_index *volume_index,
 		offset += MAGIC_SIZE;
 		decode_u32_le(buffer, &offset, &header.sparse_sample_rate);
 
-		result = VDO_ASSERT(offset == sizeof(buffer),
+		VDO_ASSERT_LOG_ONLY(offset == sizeof(buffer),
 				    "%zu bytes decoded of %zu expected", offset,
 				    sizeof(buffer));
-		if (result != VDO_SUCCESS)
-			result = UDS_CORRUPT_DATA;
 
 		if (memcmp(header.magic, MAGIC_START_6, MAGIC_SIZE) != 0)
 			return vdo_log_warning_strerror(UDS_CORRUPT_DATA,
-- 
2.39.5


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-09-09 19:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-09-08 22:24 [PATCH 1/1] dm-vdo: Refactor VDO_ASSERT usage in start_restoring_volume functions Ivan Abramov
2025-09-09 18:58 ` Matthew Sakai
2025-09-09 19:23   ` Matthew Sakai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®