mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ivan Abramov <i.abramov@mt-integration.ru>
To: Matthew Sakai <msakai@redhat.com>
Cc: Ivan Abramov <i.abramov@mt-integration.ru>,
	<dm-devel@lists.linux.dev>, <linux-kernel@vger.kernel.org>,
	<lvc-project@linuxtesting.org>
Subject: [PATCH 1/1] dm-vdo: Refactor VDO_ASSERT usage in start_restoring_volume functions
Date: Tue, 9 Sep 2025 01:24:05 +0300	[thread overview]
Message-ID: <20250908222410.223574-1-i.abramov@mt-integration.ru> (raw)

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


             reply	other threads:[~2025-09-08 22:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-08 22:24 Ivan Abramov [this message]
2025-09-09 18:58 ` Matthew Sakai
2025-09-09 19:23   ` Matthew Sakai

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=20250908222410.223574-1-i.abramov@mt-integration.ru \
    --to=i.abramov@mt-integration.ru \
    --cc=dm-devel@lists.linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lvc-project@linuxtesting.org \
    --cc=msakai@redhat.com \
    /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

all inboxes | Powered by JetHome®