The patch titled Subject: kernel.h: move sysfs related macro to sysfs.h has been added to the -mm mm-nonmm-unstable branch. Its filename is kernelh-move-sysfs-related-macro-to-sysfsh.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/kernelh-move-sysfs-related-macro-to-sysfsh.patch This patch will later appear in the mm-nonmm-unstable branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm 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/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next via the mm-everything branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm and is updated there every 2-3 working days ------------------------------------------------------ From: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx> Subject: kernel.h: move sysfs related macro to sysfs.h Date: Fri, 3 Jun 2022 20:21:01 +0300 As stated in the comment of VERIFY_OCTAL_PERMISSIONS() it's related to sysfs. Move it to the corresponding header. Link: https://lkml.kernel.org/r/20220603172101.49950-1-andriy.shevchenko@xxxxxxxxxxxxxxx Signed-off-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx> Cc: Matthew Wilcox <willy@xxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- include/linux/kernel.h | 12 ------------ include/linux/sysfs.h | 13 +++++++++++++ 2 files changed, 13 insertions(+), 12 deletions(-) --- a/include/linux/kernel.h~kernelh-move-sysfs-related-macro-to-sysfsh +++ a/include/linux/kernel.h @@ -496,16 +496,4 @@ static inline void ftrace_dump(enum ftra # define REBUILD_DUE_TO_FTRACE_MCOUNT_RECORD #endif -/* Permissions on a sysfs file: you didn't miss the 0 prefix did you? */ -#define VERIFY_OCTAL_PERMISSIONS(perms) \ - (BUILD_BUG_ON_ZERO((perms) < 0) + \ - BUILD_BUG_ON_ZERO((perms) > 0777) + \ - /* USER_READABLE >= GROUP_READABLE >= OTHER_READABLE */ \ - BUILD_BUG_ON_ZERO((((perms) >> 6) & 4) < (((perms) >> 3) & 4)) + \ - BUILD_BUG_ON_ZERO((((perms) >> 3) & 4) < ((perms) & 4)) + \ - /* USER_WRITABLE >= GROUP_WRITABLE */ \ - BUILD_BUG_ON_ZERO((((perms) >> 6) & 2) < (((perms) >> 3) & 2)) + \ - /* OTHER_WRITABLE? Generally considered a bad idea. */ \ - BUILD_BUG_ON_ZERO((perms) & 2) + \ - (perms)) #endif --- a/include/linux/sysfs.h~kernelh-move-sysfs-related-macro-to-sysfsh +++ a/include/linux/sysfs.h @@ -98,6 +98,19 @@ struct attribute_group { #define SYSFS_PREALLOC 010000 +/* Permissions on a sysfs file: you didn't miss the 0 prefix did you? */ +#define VERIFY_OCTAL_PERMISSIONS(perms) \ + (BUILD_BUG_ON_ZERO((perms) < 0) + \ + BUILD_BUG_ON_ZERO((perms) > 0777) + \ + /* USER_READABLE >= GROUP_READABLE >= OTHER_READABLE */ \ + BUILD_BUG_ON_ZERO((((perms) >> 6) & 4) < (((perms) >> 3) & 4)) + \ + BUILD_BUG_ON_ZERO((((perms) >> 3) & 4) < ((perms) & 4)) + \ + /* USER_WRITABLE >= GROUP_WRITABLE */ \ + BUILD_BUG_ON_ZERO((((perms) >> 6) & 2) < (((perms) >> 3) & 2)) + \ + /* OTHER_WRITABLE? Generally considered a bad idea. */ \ + BUILD_BUG_ON_ZERO((perms) & 2) + \ + (perms)) + #define __ATTR(_name, _mode, _show, _store) { \ .attr = {.name = __stringify(_name), \ .mode = VERIFY_OCTAL_PERMISSIONS(_mode) }, \ _ Patches currently in -mm which might be from andriy.shevchenko@xxxxxxxxxxxxxxx are rbtree-replace-kernelh-with-the-necessary-inclusions.patch xarray-replace-kernelh-with-the-necessary-inclusions.patch kernelh-move-sysfs-related-macro-to-sysfsh.patch