Skip to contentSkip to conversation

ovl: Use designated initializers

PATCH Superseded Kees Cook 2 participants 2 messages Mar 29, 2017 – Apr 4, 2017 Overlay filesystem

lore
Share & tools
lore

Kees Cook

author
#0 lore raw

PATCH 1/1 ovl: Use designated initializers

Prepare to mark sensitive kernel structures for randomization by making sure they're using designated initializers. These were identified during allyesconfig builds of x86, arm, and arm64, with most initializer fixes extracted from grsecurity.

For these cases, use { }, which will be zero-filled, instead of undesignated NULLs.

---
 fs/overlayfs/super.c | 4 ++--
 fs/overlayfs/util.c  | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
fs/overlayfs/super.c +2 -2
index c9e70d39c1ea..07c8793efb1d 100644
@@ -709,8 +709,8 @@ static const struct xattr_handler *ovl_xattr_handlers[] = {
 
 static int ovl_fill_super(struct super_block *sb, void *data, int silent)
 {
-	struct path upperpath = { NULL, NULL };
-	struct path workpath = { NULL, NULL };
+	struct path upperpath = { };
+	struct path workpath = { };
 	struct dentry *root_dentry;
 	struct inode *realinode;
 	struct ovl_entry *oe;
fs/overlayfs/util.c +1 -1
index 6e610a205e15..590fb098f763 100644
@@ -100,7 +100,7 @@ void ovl_path_lower(struct dentry *dentry, struct path *path)
 {
 	struct ovl_entry *oe = dentry->d_fsdata;
 
-	*path = oe->numlower ? oe->lowerstack[0] : (struct path) { NULL, NULL };
+	*path = oe->numlower ? oe->lowerstack[0] : (struct path) { };
 }
 
 enum ovl_path_type ovl_path_real(struct dentry *dentry, struct path *path)
Signature · 6 lines
2.7.4


-- 
Kees Cook
Pixel Security
maintainer
#1 lore raw
Quoted 7 lines · Kees Cook

Prepare to mark sensitive kernel structures for randomization by making sure they're using designated initializers. These were identified during allyesconfig builds of x86, arm, and arm64, with most initializer fixes extracted from grsecurity.

For these cases, use { }, which will be zero-filled, instead of undesignated NULLs.

Queued up for 4.12.

Thanks,
Miklos