Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753184AbcD0R0L (ORCPT ); Wed, 27 Apr 2016 13:26:11 -0400 Received: from mout.kundenserver.de ([212.227.126.130]:51844 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751865AbcD0R0K (ORCPT ); Wed, 27 Apr 2016 13:26:10 -0400 From: Arnd Bergmann To: Paul Moore Cc: Greg Kroah-Hartman , Jiri Slaby , Richard Guy Briggs , Peter Hurley , Rasmus Villemoes , linux-kernel@vger.kernel.org Subject: Re: [PATCH] tty: provide tty_name() even without CONFIG_TTY Date: Wed, 27 Apr 2016 19:24:52 +0200 Message-ID: <7168707.KQDjLLKe2j@wuerfel> User-Agent: KMail/4.11.5 (Linux/3.16.0-10-generic; KDE/4.11.5; x86_64; ; ) In-Reply-To: References: <1461750975-2735137-1-git-send-email-arnd@arndb.de> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Provags-ID: V03:K0:FZT7rwuFuld6svoAMLHV6hdSDxs5sBduSDGOrA0okH9nPt6WkUP tmBNyocAuzkVc57la/mktfgQTU3UgsJLHlZNr45Zg8O4/zybjmo7sPRjKlbdkbIwrCRHUQr DJP/slliRNtjaCSvQAWcOjUZMR3BxffOIvwBu1JOaLeFS0cnfFMQJNDZWIb48CYVVvvoNKJ 6sxcLQX1wwfaKyiUCE0Cg== X-UI-Out-Filterresults: notjunk:1;V01:K0:QQ5v70daLdo=:jS6pw5VY0RiOP5na6eHUFa UCceCae9EUdu4EhWpJWd5ANEmCGJt9F0VKOTPvRY/PkipqEuogL0xNunFrF7GzgUa+HUWx5+7 w9OkoOl7JfCv3DFhlCeDTocjtrIMl/nwpHl79I/yycNIlHowpIQP0pQc2WURStIgO17frJnq0 ZZGDDWxH1Pj0kPFjn0Uvj41aLMdxUXaYKL6rtF7/JIAYbMyy+afykJnJAICibt4wiNWU02hOy zkj5/DfHzTLWkWCniiRy1xgIuVxjm7X6qRdFyLMFSAqv57Y88VmbP9jA7hLcr6GUcKRSiUJDa 7krOkgwBFT8FKi4DISxG27z8SDrYYMIw4mFxuhhFZeR+vVZKQHomPz1D8+mAcuVOA2XWVx3HY 9JsDiEGldfVECK5QxHVOdJxzkxLrqoTmUmL3CJMscZxWWEgP3mxYQtzm0j89ZpW4J0MyXsoMG 07hqe/CER5SWejM1bxvVyoB5T71pTp2TsJiZbimC3SGCnKRU40Sp6QvHEZeQdRFW7YBtVYYQv jtMQQonH4cncO+hsHficMTCvXuYVyqlOKyW6vSGYNUQ2H1AwL7SFZt+4+XjVCBjqEUYdydSHP 42YDhETUDZ7y9m2W+SQYq0uoxVeiViRm0Z4mMMuvwKBbgBZlyTxk4MG4HRQQK1NSrpHqt7jUh AmZM2IUGOScynVZdkC09LBtsB8rqzSx4/na1KXwc2Hncq50M2p1+7tc/uttKXPUtMPZ/UyxD2 4ie8bS9t1w6cE4h2 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1555 Lines: 36 On Wednesday 27 April 2016 12:20:02 Paul Moore wrote: > > diff --git a/include/linux/tty.h b/include/linux/tty.h > > index 3b09f235db66..17b247c94440 100644 > > --- a/include/linux/tty.h > > +++ b/include/linux/tty.h > > @@ -371,6 +371,7 @@ extern void proc_clear_tty(struct task_struct *p); > > extern struct tty_struct *get_current_tty(void); > > /* tty_io.c */ > > extern int __init tty_init(void); > > +extern const char *tty_name(const struct tty_struct *tty); > > #else > > static inline void console_init(void) > > { } > > @@ -391,6 +392,8 @@ static inline struct tty_struct *get_current_tty(void) > > /* tty_io.c */ > > static inline int __init tty_init(void) > > { return 0; } > > +static inline const char *tty_name(const struct tty_struct *tty) > > +{ return "(none)"; } > > #endif > > As it currently stands tty_name() returns "NULL tty" when the passed > tty_struct is NULL while this patch returns "(none)" in the case of > CONFIG_TTY=n; it seems like some consistency might be good, yes? Or > do you think there is value in differentiating between the two cases? > > From an audit point of view, we would prefer if both were "(none)". Right, I noticed that the audit code prints "(none)" here while the tty code prints "NULL tty", and that meant I could not make it behave the same way as all the existing code. I picked "(none)" because in case of CONFIG_TTY being disabled that is more logical: it's not a NULL pointer because something went wrong, but instead the pointer doesn't matter and we know there is no tty. Arnd