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 for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZxxmLngMg3iNjOfK@mail.google.com>
Date: Sat, 26 Oct 2024 16:46:54 +1300
From: Paulo Miguel Almeida <paulo.miguel.almeida.rodenas@...il.com>
To: richard@....at, anton.ivanov@...bridgegreys.com,
	johannes@...solutions.net, kees@...nel.org, tiwei.btw@...group.com,
	linux-um@...ts.infradead.org, linux-kernel@...r.kernel.org
Cc: paulo.miguel.almeida.rodenas@...il.com
Subject: [PATCH][next] um: Malloc just enough space for fitting pid file

umid is already generated during make_umid_init __initcall so there is
no need to allocate UMID_LEN bytes to accommodate the max possible name
for the umid segment of the filepath

This patch replaces UMID_LEN occurences in which it's redundant

Signed-off-by: Paulo Miguel Almeida <paulo.miguel.almeida.rodenas@...il.com>
---
 arch/um/os-Linux/umid.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/um/os-Linux/umid.c b/arch/um/os-Linux/umid.c
index eb523ab1e218..513a2cce38db 100644
--- a/arch/um/os-Linux/umid.c
+++ b/arch/um/os-Linux/umid.c
@@ -212,7 +212,7 @@ static void __init create_pid_file(void)
 	char pid[sizeof("nnnnnnnnn")], *file;
 	int fd, n;
 
-	n = strlen(uml_dir) + UMID_LEN + sizeof("/pid");
+	n = strlen(uml_dir) + strlen(umid) + sizeof("/pid");
 	file = malloc(n);
 	if (!file)
 		return;
@@ -394,7 +394,7 @@ static void remove_umid_dir(void)
 {
 	char *dir, err;
 
-	dir = malloc(strlen(uml_dir) + UMID_LEN + 1);
+	dir = malloc(strlen(uml_dir) + strlen(umid) + 1);
 	if (!dir)
 		return;
 
-- 
2.47.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ