mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Price <anprice@redhat.com>
To: Wolfram Sang <wsa+renesas@sang-engineering.com>
Cc: cluster-devel@redhat.com, linux-kernel@vger.kernel.org,
	Andreas Gruenbacher <agruenba@redhat.com>,
	Bob Peterson <rpeterso@redhat.com>
Subject: Re: [Cluster-devel] [PATCH] gfs2: move from strlcpy with unused retval to strscpy
Date: Thu, 25 Aug 2022 10:32:58 +0100	[thread overview]
Message-ID: <d53a4672-d068-c394-6ab1-058b2d72701f@redhat.com> (raw)
In-Reply-To: <YwaFRvWw5hi/uWYs@shikoro>

On 24/08/2022 21:08, Wolfram Sang wrote:
> Hi Andy.
> 
>>> -	strlcpy(sdp->sd_proto_name, proto, GFS2_FSNAME_LEN);
>>> -	strlcpy(sdp->sd_table_name, table, GFS2_FSNAME_LEN);
>>> +	strscpy(sdp->sd_proto_name, proto, GFS2_FSNAME_LEN);
>>> +	strscpy(sdp->sd_table_name, table, GFS2_FSNAME_LEN);
>>
>> Perhaps the size should be changed to GFS2_LOCKNAME_LEN to match the size of
>> the destination, too.
>>
>> With that addition, this patch fixes this syzkaller report:
>>
>> https://listman.redhat.com/archives/cluster-devel/2022-August/022755.html
> 
> Linus wrote another summary about strlcpy vs. strscpy use[1]. So, the
> size argument should be the size of the smaller buffer if the buffers
> are of different size. GFS2_LOCKNAME_LEN is smaller, so that looks
> suitable. Shall I resend the patch with the suggested change?

Yes, please. I can't speak for the gfs2 maintainers but I think it would 
be a good plan, as the combination of strscpy and the size change fixes 
a bug.

Andy

> 
> All the best,
> 
>     Wolfram
> 
> [1] https://lore.kernel.org/lkml/CAHk-=wi+xbVq++uqW9YgWpHjyBHNB8a-xad+Xp23-B+eodLCEA@mail.gmail.com/
> 


  reply	other threads:[~2022-08-25  9:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-18 21:01 Wolfram Sang
2022-08-23  9:37 ` [Cluster-devel] " Andrew Price
2022-08-24 20:08   ` Wolfram Sang
2022-08-25  9:32     ` Andrew Price [this message]
2022-08-26 13:28       ` Andreas Gruenbacher

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=d53a4672-d068-c394-6ab1-058b2d72701f@redhat.com \
    --to=anprice@redhat.com \
    --cc=agruenba@redhat.com \
    --cc=cluster-devel@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rpeterso@redhat.com \
    --cc=wsa+renesas@sang-engineering.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®