[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Wed, 7 Jul 2021 04:52:41 +0000
From: Justin He <Justin.He@....com>
To: Al Viro <viro@...iv.linux.org.uk>,
Linus Torvalds <torvalds@...ux-foundation.org>
CC: Petr Mladek <pmladek@...e.com>,
Steven Rostedt <rostedt@...dmis.org>,
Sergey Senozhatsky <senozhatsky@...omium.org>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Rasmus Villemoes <linux@...musvillemoes.dk>,
Jonathan Corbet <corbet@....net>,
Heiko Carstens <hca@...ux.ibm.com>,
Vasily Gorbik <gor@...ux.ibm.com>,
Christian Borntraeger <borntraeger@...ibm.com>,
"Eric W . Biederman" <ebiederm@...ssion.com>,
"Darrick J. Wong" <darrick.wong@...cle.com>,
"Peter Zijlstra (Intel)" <peterz@...radead.org>,
Ira Weiny <ira.weiny@...el.com>,
Eric Biggers <ebiggers@...gle.com>,
"Ahmed S. Darwish" <a.darwish@...utronix.de>,
"open list:DOCUMENTATION" <linux-doc@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
linux-s390 <linux-s390@...r.kernel.org>,
linux-fsdevel <linux-fsdevel@...r.kernel.org>, nd <nd@....com>
Subject: RE: [PATCH 02/14] d_path: saner calling conventions for
__dentry_path()
> -----Original Message-----
> From: Justin He
> Sent: Friday, June 25, 2021 5:33 PM
> To: Al Viro <viro@...iv.linux.org.uk>; Linus Torvalds <torvalds@...ux-
> foundation.org>
> Cc: Petr Mladek <pmladek@...e.com>; Steven Rostedt <rostedt@...dmis.org>;
> Sergey Senozhatsky <senozhatsky@...omium.org>; Andy Shevchenko
> <andriy.shevchenko@...ux.intel.com>; Rasmus Villemoes
> <linux@...musvillemoes.dk>; Jonathan Corbet <corbet@....net>; Heiko
> Carstens <hca@...ux.ibm.com>; Vasily Gorbik <gor@...ux.ibm.com>; Christian
> Borntraeger <borntraeger@...ibm.com>; Eric W . Biederman
> <ebiederm@...ssion.com>; Darrick J. Wong <darrick.wong@...cle.com>; Peter
> Zijlstra (Intel) <peterz@...radead.org>; Ira Weiny <ira.weiny@...el.com>;
> Eric Biggers <ebiggers@...gle.com>; Ahmed S. Darwish
> <a.darwish@...utronix.de>; open list:DOCUMENTATION <linux-
> doc@...r.kernel.org>; Linux Kernel Mailing List <linux-
> kernel@...r.kernel.org>; linux-s390 <linux-s390@...r.kernel.org>; linux-
> fsdevel <linux-fsdevel@...r.kernel.org>
> Subject: RE: [PATCH 02/14] d_path: saner calling conventions for
> __dentry_path()
>
> Hi Al
>
> > -----Original Message-----
> > From: Al Viro <viro@....linux.org.uk> On Behalf Of Al Viro
> > Sent: Wednesday, May 19, 2021 8:49 AM
> > To: Linus Torvalds <torvalds@...ux-foundation.org>
> > Cc: Justin He <Justin.He@....com>; Petr Mladek <pmladek@...e.com>; Steven
> > Rostedt <rostedt@...dmis.org>; Sergey Senozhatsky
> > <senozhatsky@...omium.org>; Andy Shevchenko
> > <andriy.shevchenko@...ux.intel.com>; Rasmus Villemoes
> > <linux@...musvillemoes.dk>; Jonathan Corbet <corbet@....net>; Heiko
> > Carstens <hca@...ux.ibm.com>; Vasily Gorbik <gor@...ux.ibm.com>;
> Christian
> > Borntraeger <borntraeger@...ibm.com>; Eric W . Biederman
> > <ebiederm@...ssion.com>; Darrick J. Wong <darrick.wong@...cle.com>; Peter
> > Zijlstra (Intel) <peterz@...radead.org>; Ira Weiny <ira.weiny@...el.com>;
> > Eric Biggers <ebiggers@...gle.com>; Ahmed S. Darwish
> > <a.darwish@...utronix.de>; open list:DOCUMENTATION <linux-
> > doc@...r.kernel.org>; Linux Kernel Mailing List <linux-
> > kernel@...r.kernel.org>; linux-s390 <linux-s390@...r.kernel.org>; linux-
> > fsdevel <linux-fsdevel@...r.kernel.org>
> > Subject: [PATCH 02/14] d_path: saner calling conventions for
> __dentry_path()
> >
> > 1) lift NUL-termination into the callers
> > 2) pass pointer to the end of buffer instead of that to beginning.
> >
> > (1) allows to simplify dentry_path() - we don't need to play silly
> > games with restoring the leading / of "//deleted" after __dentry_path()
> > would've overwritten it with NUL.
> >
> > We also do not need to check if (either) prepend() in there fails -
> > if the buffer is not large enough, we'll end with negative buflen
> > after prepend() and __dentry_path() will return the right value
> > (ERR_PTR(-ENAMETOOLONG)) just fine.
> >
> > Signed-off-by: Al Viro <viro@...iv.linux.org.uk>
> > ---
> > fs/d_path.c | 33 +++++++++++++--------------------
> > 1 file changed, 13 insertions(+), 20 deletions(-)
> >
> > diff --git a/fs/d_path.c b/fs/d_path.c
> > index 01df5dfa1f88..1a1cf05e7780 100644
> > --- a/fs/d_path.c
> > +++ b/fs/d_path.c
> > @@ -326,22 +326,21 @@ char *simple_dname(struct dentry *dentry, char
> > *buffer, int buflen)
> > /*
> > * Write full pathname from the root of the filesystem into the buffer.
> > */
> I suggest adding the comments to remind NUL terminator should be prepended
> before invoking __dentry_path()
>
Except for my suggestion about adding comments
Reviewed-by: Jia He <justin.he@....com>
Powered by blists - more mailing lists