[Crash-utility] [PATCH 1/2] memory_driver: Use designated initializer for 'crash_dev'

Mathias Krause minipli at grsecurity.net
Tue Sep 26 10:12:46 UTC 2023


Instead of using positional initialization, use the more modern
designated initializer style, as already used for 'crash_fops'.

This makes the member initialization not only less ambiguous but also
allows structure layout randomization of the underlying type (as done in
grsecurity).

Signed-off-by: Mathias Krause <minipli at grsecurity.net>
---
 memory_driver/crash.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/memory_driver/crash.c b/memory_driver/crash.c
index 81bd0e5c1aec..4999ed4113b7 100644
--- a/memory_driver/crash.c
+++ b/memory_driver/crash.c
@@ -324,9 +324,9 @@ static struct file_operations crash_fops = {
 };
 
 static struct miscdevice crash_dev = {
-	MISC_DYNAMIC_MINOR,
-	"crash",
-	&crash_fops
+	.minor = MISC_DYNAMIC_MINOR,
+	.name = "crash",
+	.fops = &crash_fops
 };
 
 static int __init
-- 
2.30.2



More information about the Crash-utility mailing list