The patch titled Subject: cred/userns: define current_user_ns() as a function has been added to the -mm tree. Its filename is cred-userns-define-current_user_ns-as-a-function.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/cred-userns-define-current_user_ns-as-a-function.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/cred-userns-define-current_user_ns-as-a-function.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/SubmitChecklist when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Arnd Bergmann <arnd@xxxxxxxx> Subject: cred/userns: define current_user_ns() as a function The current_user_ns() macro currently returns &init_user_ns when user namespaces are disabled, and that causes several warnings when building with gcc-6.0 in code that compares the result of the macro to &init_user_ns itself: fs/xfs/xfs_ioctl.c: In function 'xfs_ioctl_setattr_check_projid': fs/xfs/xfs_ioctl.c:1249:22: error: self-comparison always evaluates to true [-Werror=tautological-compare] if (current_user_ns() == &init_user_ns) This is a legitimate warning in principle, but here it isn't really helpful, so I'm reprasing the definition in a way that shuts up the warning. Apparently gcc only warns when comparing identical literals, but it can figure out that the result of an inline function can be identical to a constant expression in order to optimize a condition yet not warn about the fact that the condition is known at compile time. This is exactly what we want here, and it looks reasonable because we generally prefer inline functions over macros anyway. Signed-off-by: Arnd Bergmann <arnd@xxxxxxxx> Acked-by: Serge Hallyn <serge.hallyn@xxxxxxxxxxxxx> Cc: David Howells <dhowells@xxxxxxxxxx> Cc: Yaowei Bai <baiyaowei@xxxxxxxxxxxxxxxxxxxx> Cc: James Morris <james.l.morris@xxxxxxxxxx> Cc: "Paul E. McKenney" <paulmck@xxxxxxxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- include/linux/capability.h | 2 -- include/linux/cred.h | 5 ++++- 2 files changed, 4 insertions(+), 3 deletions(-) diff -puN include/linux/capability.h~cred-userns-define-current_user_ns-as-a-function include/linux/capability.h --- a/include/linux/capability.h~cred-userns-define-current_user_ns-as-a-function +++ a/include/linux/capability.h @@ -40,8 +40,6 @@ struct inode; struct dentry; struct user_namespace; -struct user_namespace *current_user_ns(void); - extern const kernel_cap_t __cap_empty_set; extern const kernel_cap_t __cap_init_eff_set; diff -puN include/linux/cred.h~cred-userns-define-current_user_ns-as-a-function include/linux/cred.h --- a/include/linux/cred.h~cred-userns-define-current_user_ns-as-a-function +++ a/include/linux/cred.h @@ -377,7 +377,10 @@ extern struct user_namespace init_user_n #ifdef CONFIG_USER_NS #define current_user_ns() (current_cred_xxx(user_ns)) #else -#define current_user_ns() (&init_user_ns) +static inline struct user_namespace *current_user_ns(void) +{ + return &init_user_ns; +} #endif _ Patches currently in -mm which might be from arnd@xxxxxxxx are paride-make-verbose-parameter-an-int-again.patch mm-compaction-introduce-kcompactd-fix.patch mm-page_ref-add-tracepoint-to-track-down-page-reference-manipulation-fix-2.patch cred-userns-define-current_user_ns-as-a-function.patch profile-hide-unused-functions-when-config_proc_fs.patch staging-goldfish-use-6-arg-get_user_pages.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html