From: Matthew Sakai <msakai@redhat.com>
To: Ivan Abramov <i.abramov@mt-integration.ru>
Cc: dm-devel@lists.linux.dev, linux-kernel@vger.kernel.org,
lvc-project@linuxtesting.org
Subject: Re: [PATCH 1/1] dm-vdo: Refactor VDO_ASSERT usage in start_restoring_volume functions
Date: Tue, 9 Sep 2025 15:23:06 -0400 [thread overview]
Message-ID: <1788ec12-c362-440a-b63e-fc720bd5a18d@redhat.com> (raw)
In-Reply-To: <340645fa-5c6b-4b28-bd56-63088d4705da@redhat.com>
On 9/9/25 2:58 PM, Matthew Sakai wrote:
> On 9/8/25 6:24 PM, Ivan Abramov wrote:
>> 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;
>
> This is not a correct fix so we should not take this.
>
> This assertion (and the one below) should only fail if the stored
> metadata has been corrupted, but in that case we definitely need to
> return the error and fail the load.
>
> You are correct that we don't seem to use this result, but the correct
> fix is to return UDS_CORRUPT_DATA when this assertion fails.
Replying to myself, feel free to correct this patch, or I can probably
get to posting a proper fix later in the week.
> Matt
>
>
>> 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,
>
prev parent reply other threads:[~2025-09-09 19:23 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-08 22:24 Ivan Abramov
2025-09-09 18:58 ` Matthew Sakai
2025-09-09 19:23 ` Matthew Sakai [this message]
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=1788ec12-c362-440a-b63e-fc720bd5a18d@redhat.com \
--to=msakai@redhat.com \
--cc=dm-devel@lists.linux.dev \
--cc=i.abramov@mt-integration.ru \
--cc=linux-kernel@vger.kernel.org \
--cc=lvc-project@linuxtesting.org \
/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®