lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190425203101.9403-1-linux@rasmusvillemoes.dk>
Date:   Thu, 25 Apr 2019 22:31:01 +0200
From:   Rasmus Villemoes <linux@...musvillemoes.dk>
To:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Arnd Bergmann <arnd@...db.de>,
        "Darren Hart (VMware)" <dvhart@...radead.org>,
        Mattias Jacobsson <2pi@....nu>
Cc:     Jeff Mahoney <jeffm@...e.com>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Rasmus Villemoes <linux@...musvillemoes.dk>,
        linux-kernel@...r.kernel.org
Subject: [PATCH] mod_devicetable.h: reduce sizeof(struct of_device_id) by 80 bytes

A typical kernel image has hundreds of static struct of_device_id
instances (a lot of which are sentinel all-zeroes), each occupying
~200 bytes. Nobody initializes the .compatible member with strings
anywhere near 128 bytes, so a lot of that memory is simply wasted.

To verify, I first had the 0day bot chew on a patch adding a dummy
extremely long .compatible string, and I did get an email saying that
the patch resulted in lots of new
"warning:initializer-string-for-array-of-chars-is-too-long"
warnings. Then I had it chew on a version of this patch reducing to 46
(because gcc unfortunately does not warn when the literal sans the
terminating nul just fits), and got a SUCCESS mail listing 107
config/arch combinations.

For an arm imx_v6_v7_defconfig kernel, .rodata becomes 70K smaller;
.init.data shrinks by another ~13K, making the whole kernel image
about 83K, or 0.3%, smaller.

Signed-off-by: Rasmus Villemoes <linux@...musvillemoes.dk>
---
 include/linux/mod_devicetable.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
index 448621c32e4d..502629bdac2e 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -241,7 +241,7 @@ struct sdw_device_id {
 struct of_device_id {
 	char	name[32];
 	char	type[32];
-	char	compatible[128];
+	char	compatible[48];
 	const void *data;
 };
 
-- 
2.20.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ