Commit f1fffbd4 authored by Rasmus Villemoes's avatar Rasmus Villemoes Committed by Linus Torvalds

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.dkSigned-off-by: default avatarRasmus 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: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent ef27ac18
...@@ -39,7 +39,6 @@ ...@@ -39,7 +39,6 @@
#include <linux/bitops.h> #include <linux/bitops.h>
#include <linux/init_task.h> #include <linux/init_task.h>
#include <linux/uaccess.h> #include <linux/uaccess.h>
#include <linux/build_bug.h>
#include "internal.h" #include "internal.h"
#include "mount.h" #include "mount.h"
...@@ -131,7 +130,6 @@ getname_flags(const char __user *filename, int flags, int *empty) ...@@ -131,7 +130,6 @@ getname_flags(const char __user *filename, int flags, int *empty)
struct filename *result; struct filename *result;
char *kname; char *kname;
int len; int len;
BUILD_BUG_ON(offsetof(struct filename, iname) % sizeof(long) != 0);
result = audit_reusename(filename); result = audit_reusename(filename);
if (result) if (result)
......
...@@ -37,6 +37,8 @@ ...@@ -37,6 +37,8 @@
#include <linux/uuid.h> #include <linux/uuid.h>
#include <linux/errseq.h> #include <linux/errseq.h>
#include <linux/ioprio.h> #include <linux/ioprio.h>
#include <linux/build_bug.h>
#include <linux/stddef.h>
#include <asm/byteorder.h> #include <asm/byteorder.h>
#include <uapi/linux/fs.h> #include <uapi/linux/fs.h>
...@@ -2493,6 +2495,7 @@ struct filename { ...@@ -2493,6 +2495,7 @@ struct filename {
struct audit_names *aname; struct audit_names *aname;
const char iname[]; const char iname[];
}; };
static_assert(offsetof(struct filename, iname) % sizeof(long) == 0);
extern long vfs_truncate(const struct path *, loff_t); extern long vfs_truncate(const struct path *, loff_t);
extern int do_truncate(struct dentry *, loff_t start, unsigned int time_attrs, extern int do_truncate(struct dentry *, loff_t start, unsigned int time_attrs,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment