add patch dont-mark-mmp-buffer-head-dirty
[ext4-patch-queue.git] / add-nonstring-annotations-to-ext4.h
bloba92f104bfd9b7ee45ab10988b199c4c6e4ffd8c0
1 ext4: add nonstring annotations to ext4.h
3 This suppresses some false positives in gcc 8's -Wstringop-truncation
5 Suggested by Miguel Ojeda (hopefully the __nonstring definition will
6 eventually get accepted in the compiler-gcc.h header file).
8 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
9 Cc: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
10 ---
11 fs/ext4/ext4.h | 17 ++++++++++++++---
12 1 file changed, 14 insertions(+), 3 deletions(-)
14 diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
15 index 1fc013f3d944..249bcee4d7b2 100644
16 --- a/fs/ext4/ext4.h
17 +++ b/fs/ext4/ext4.h
18 @@ -43,6 +43,17 @@
19 #define __FS_HAS_ENCRYPTION IS_ENABLED(CONFIG_EXT4_FS_ENCRYPTION)
20 #include <linux/fscrypt.h>
22 +#include <linux/compiler.h>
24 +/* Until this gets included into linux/compiler-gcc.h */
25 +#ifndef __nonstring
26 +#if defined(GCC_VERSION) && (GCC_VERSION >= 80000)
27 +#define __nonstring __attribute__((nonstring))
28 +#else
29 +#define __nonstring
30 +#endif
31 +#endif
34 * The fourth extended filesystem constants/structures
36 @@ -1226,7 +1237,7 @@ struct ext4_super_block {
37 __le32 s_feature_ro_compat; /* readonly-compatible feature set */
38 /*68*/ __u8 s_uuid[16]; /* 128-bit uuid for volume */
39 /*78*/ char s_volume_name[16]; /* volume name */
40 -/*88*/ char s_last_mounted[64]; /* directory where last mounted */
41 +/*88*/ char s_last_mounted[64] __nonstring; /* directory where last mounted */
42 /*C8*/ __le32 s_algorithm_usage_bitmap; /* For compression */
44 * Performance hints. Directory preallocation should only
45 @@ -1277,13 +1288,13 @@ struct ext4_super_block {
46 __le32 s_first_error_time; /* first time an error happened */
47 __le32 s_first_error_ino; /* inode involved in first error */
48 __le64 s_first_error_block; /* block involved of first error */
49 - __u8 s_first_error_func[32]; /* function where the error happened */
50 + __u8 s_first_error_func[32] __nonstring; /* function where the error happened */
51 __le32 s_first_error_line; /* line number where error happened */
52 __le32 s_last_error_time; /* most recent time of an error */
53 __le32 s_last_error_ino; /* inode involved in last error */
54 __le32 s_last_error_line; /* line number where error happened */
55 __le64 s_last_error_block; /* block involved of last error */
56 - __u8 s_last_error_func[32]; /* function where the error happened */
57 + __u8 s_last_error_func[32] __nonstring; /* function where the error happened */
58 #define EXT4_S_ERR_END offsetof(struct ext4_super_block, s_mount_opts)
59 __u8 s_mount_opts[64];
60 __le32 s_usr_quota_inum; /* inode for tracking user quota */