[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f9b82ff6-49c6-b3e9-361f-1459d884c273@sandeen.net>
Date: Fri, 25 May 2018 15:21:08 -0500
From: Eric Sandeen <sandeen@...deen.net>
To: Arnd Bergmann <arnd@...db.de>, Eric Sandeen <sandeen@...hat.com>
Cc: "Darrick J. Wong" <darrick.wong@...cle.com>,
linux-xfs <linux-xfs@...r.kernel.org>,
Martin Sebor <msebor@...il.com>,
Brian Foster <bfoster@...hat.com>,
Dave Chinner <dchinner@...hat.com>,
Dan Williams <dan.j.williams@...el.com>,
Ross Zwisler <ross.zwisler@...ux.intel.com>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] xfs: mark sb_fname as nonstring
On 5/25/18 3:16 PM, Arnd Bergmann wrote:
> On Fri, May 25, 2018 at 6:53 PM, Eric Sandeen <sandeen@...hat.com> wrote:
>> On 5/25/18 10:14 AM, Arnd Bergmann wrote:
...
>>> @@ -1860,7 +1860,7 @@ xfs_ioc_setlabel(
>>> spin_lock(&mp->m_sb_lock);
>>> memset(sbp->sb_fname, 0, sizeof(sbp->sb_fname));
>>> - strncpy(sbp->sb_fname, label, sizeof(sbp->sb_fname));
>>> + memcpy(sbp->sb_fname, label, len);
>>
>>
>> Hm but len = strnlen(label, XFSLABEL_MAX + 1);
>> which could be one longer than sbp->sb_fname, no?
>
> We have an explicit check for that, so I think it's ok:
>
> if (len > sizeof(sbp->sb_fname))
> return -EINVAL;
Ah so we do; I wrote this at least 2 weeks ago, you're asking a lot for
me to remember it. (or to even read it, apparently). ;)
Thanks,
-Eric
Powered by blists - more mailing lists