RE: [PATCH 05/14] getcwd(2): saner logics around prepend_path() call
From: Justin He <hidden>
Date: 2021-07-07 07:41:53
Also in:
linux-fsdevel, linux-s390, lkml
From: Justin He <hidden>
Date: 2021-07-07 07:41:53
Also in:
linux-fsdevel, linux-s390, lkml
-----Original Message----- From: Al Viro <redacted> On Behalf Of Al Viro Sent: Wednesday, May 19, 2021 8:49 AM To: Linus Torvalds <torvalds@linux-foundation.org> Cc: Justin He <redacted>; Petr Mladek <pmladek@suse.com>; Steven Rostedt [off-list ref]; Sergey Senozhatsky [off-list ref]; Andy Shevchenko [off-list ref]; Rasmus Villemoes [off-list ref]; Jonathan Corbet [off-list ref]; Heiko Carstens [off-list ref]; Vasily Gorbik [off-list ref]; Christian Borntraeger [off-list ref]; Eric W . Biederman [off-list ref]; Darrick J. Wong [off-list ref]; Peter Zijlstra (Intel) [off-list ref]; Ira Weiny [off-list ref]; Eric Biggers [off-list ref]; Ahmed S. Darwish [off-list ref]; open list:DOCUMENTATION <linux- doc@vger.kernel.org>; Linux Kernel Mailing List <linux- kernel@vger.kernel.org>; linux-s390 [off-list ref]; linux- fsdevel [off-list ref] Subject: [PATCH 05/14] getcwd(2): saner logics around prepend_path() call The only negative value that might get returned by prepend_path() is -ENAMETOOLONG, and that happens only on overflow. The same goes for prepend_unreachable(). Overflow is detectable by observing negative buflen, so we can simplify the control flow around the prepend_path() call. Expand prepend_unreachable(), while we are at it - that's the only caller. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Reviewed-by: Jia He <redacted> -- Cheers, Justin (Jia He)