[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <2331c1248aceff966403c0f3c5d527c95c930b5b.camel@perches.com>
Date: Thu, 25 Jul 2019 09:41:00 -0700
From: Joe Perches <joe@...ches.com>
To: Qian Cai <cai@....pw>, David Laight <David.Laight@...LAB.COM>,
"akpm@...ux-foundation.org" <akpm@...ux-foundation.org>
Cc: "tobin@...nel.org" <tobin@...nel.org>,
"rostedt@...dmis.org" <rostedt@...dmis.org>,
"mingo@...hat.com" <mingo@...hat.com>,
"tj@...nel.org" <tj@...nel.org>,
"dchinner@...hat.com" <dchinner@...hat.com>,
"fengguang.wu@...el.com" <fengguang.wu@...el.com>,
"jack@...e.cz" <jack@...e.cz>, "axboe@...nel.dk" <axboe@...nel.dk>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2] writeback: fix -Wstringop-truncation warnings
On Thu, 2019-07-25 at 11:50 -0400, Qian Cai wrote:
> > > diff --git a/include/trace/events/writeback.h b/include/trace/events/writeback.h
[]
> > > @@ -66,8 +66,10 @@
> > > ),
> > >
> > > TP_fast_assign(
> > > - strncpy(__entry->name,
> > > - mapping ? dev_name(inode_to_bdi(mapping->host)-
> > > > dev) : "(unknown)", 32);
> > >
> > > + strscpy_pad(__entry->name,
> > > + mapping ?
> > > + dev_name(inode_to_bdi(mapping->host)->dev) :
> > > + "(unknown)", 32);
> >
> > Shouldn't the 32 be 'sizeof (something)' ??
>
> Maybe could do a sizeof(__entry->name) as it is defined as,
>
> TP_STRUCT__entry (
> __array(char, name, 32)
> __field(unsigned long, ino)
> __field(pgoff_t, index)
>
> But, that might be a follow-up patch and does not seem belong here.
stracpy_pad would work one day.
Powered by blists - more mailing lists