Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

linux/fs.h: move member alignment check next to definition of struct filename

Instead of doing this compile-time check in some slightly arbitrary user
of struct filename, put it next to the definition.

Link: http://lkml.kernel.org/r/20190208203015.29702-3-linux@rasmusvillemoes.dk
Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: Kees Cook <keescook@chromium.org>
Cc: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Nick Desaulniers <ndesaulniers@google.com>
Cc: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Rasmus Villemoes and committed by
Linus Torvalds
f1fffbd4 ef27ac18

+3 -2
-2
fs/namei.c
··· 39 39 #include <linux/bitops.h> 40 40 #include <linux/init_task.h> 41 41 #include <linux/uaccess.h> 42 - #include <linux/build_bug.h> 43 42 44 43 #include "internal.h" 45 44 #include "mount.h" ··· 130 131 struct filename *result; 131 132 char *kname; 132 133 int len; 133 - BUILD_BUG_ON(offsetof(struct filename, iname) % sizeof(long) != 0); 134 134 135 135 result = audit_reusename(filename); 136 136 if (result)
+3
include/linux/fs.h
··· 37 37 #include <linux/uuid.h> 38 38 #include <linux/errseq.h> 39 39 #include <linux/ioprio.h> 40 + #include <linux/build_bug.h> 41 + #include <linux/stddef.h> 40 42 41 43 #include <asm/byteorder.h> 42 44 #include <uapi/linux/fs.h> ··· 2495 2493 struct audit_names *aname; 2496 2494 const char iname[]; 2497 2495 }; 2496 + static_assert(offsetof(struct filename, iname) % sizeof(long) == 0); 2498 2497 2499 2498 extern long vfs_truncate(const struct path *, loff_t); 2500 2499 extern int do_truncate(struct dentry *, loff_t start, unsigned int time_attrs,