Linux kernel -stable discussions
 help / color / mirror / Atom feed
From: Damien Le Moal <dlemoal@kernel.org>
To: Yingjie Wang <x-professor@outlook.com>,
	Alasdair Kergon <agk@redhat.com>,
	Mike Snitzer <snitzer@kernel.org>,
	Mikulas Patocka <mpatocka@redhat.com>,
	Benjamin Marzinski <bmarzins@redhat.com>
Cc: "dm-devel@lists.linux.dev" <dm-devel@lists.linux.dev>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Hannes Reinecke <hare@suse.de>,
	"stable@vger.kernel.org" <stable@vger.kernel.org>
Subject: Re: [PATCH v2 3/3] dm zoned: handle labels that are not NUL-terminated
Date: Sun, 6 Dec 2026 08:35:27 +0900	[thread overview]
Message-ID: <94316689-90c7-4284-a35c-fdffb6fa3a8c@kernel.org> (raw)
In-Reply-To: <20261205062130.2080494-1-x-professor@outlook.com>

On 12/5/26 15:21, Yingjie Wang wrote:
> Hi Damien,
> 
> On 12/4/26 16:42, Damien Le Moal wrote:
>>>  		if (strlen(zmd->label) &&
>>>  		    memcmp(zmd->label, sb->dmz_label, BDEVNAME_SIZE)) {
>>> -			dmz_dev_err(dev, "mismatching DM-Zoned label, is %s expected %s",
>>> +			dmz_dev_err(dev, "mismatching DM-Zoned label, is %.32s expected %s",
>>
>> The copy of the label is at most BDEVNAME_SIZE, so the +1 char is always NUL and
>> this change is not needed.
>>
>>>  				    sb->dmz_label, zmd->label);
> 
> The %.32s is for sb->dmz_label, the label in the superblock being
> checked, not for the copy in zmd->label.  sb->dmz_label is the 32-byte
> field in the metadata block, so if the label on disk uses all 32 bytes,
> %s reads on into the UUIDs and reserved bytes after it, and past the end
> of the block if none of them is zero.  That is the second report in the
> commit message.
> 
> zmd->label is NUL-terminated thanks to the extra byte, so it is still
> printed with %s.

Doh! I missed that. So this is good as is.

Reviewed-by: Damien Le Moal <dlemoal@kernel.org>


-- 
Damien Le Moal
Western Digital Research

      reply	other threads:[~2026-12-05 23:35 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20261203090240.1180833-1-x-professor@outlook.com>
2026-12-03  9:02 ` [PATCH v2 1/3] dm zoned: do not update metadata state from an invalid superblock Yingjie Wang
2026-12-03  9:02 ` [PATCH v2 2/3] dm zoned: validate the metadata layout in the superblock Yingjie Wang
2026-12-03  9:03 ` [PATCH v2 3/3] dm zoned: handle labels that are not NUL-terminated Yingjie Wang
2026-12-04  7:42   ` Damien Le Moal
2026-12-05  6:21     ` Yingjie Wang
2026-12-05 23:35       ` Damien Le Moal [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=94316689-90c7-4284-a35c-fdffb6fa3a8c@kernel.org \
    --to=dlemoal@kernel.org \
    --cc=agk@redhat.com \
    --cc=bmarzins@redhat.com \
    --cc=dm-devel@lists.linux.dev \
    --cc=hare@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mpatocka@redhat.com \
    --cc=snitzer@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=x-professor@outlook.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