All of lore.kernel.org
 help / color / mirror / Atom feed
* + init-simplify-early_hostname.patch added to mm-nonmm-unstable branch
@ 2026-08-28 18:26 Andrew Morton
  0 siblings, 0 replies; only message in thread
From: Andrew Morton @ 2026-08-28 18:26 UTC (permalink / raw)
  To: mm-commits, blum, akpm


The patch titled
     Subject: init: simplify early_hostname()
has been added to the -mm mm-nonmm-unstable branch.  Its filename is
     init-simplify-early_hostname.patch

This patch will shortly appear at
     https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/init-simplify-early_hostname.patch

This patch will later appear in the mm-nonmm-unstable branch at
    git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next via various
branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there most days

------------------------------------------------------
From: Thorsten Blum <blum@kernel.org>
Subject: init: simplify early_hostname()
Date: Fri, 28 Aug 2026 19:43:37 +0200

Inline the strscpy() check and remove the redundant arglen variable.  Use
%zu to format the unsigned maxlen argument and add a newline after the
truncation warning.

Link: https://lore.kernel.org/20260828174337.609333-2-blum@kernel.org
Signed-off-by: Thorsten Blum <blum@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 init/version.c |    8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

--- a/init/version.c~init-simplify-early_hostname
+++ a/init/version.c
@@ -21,16 +21,14 @@ static int __init early_hostname(char *a
 {
 	size_t bufsize = sizeof(init_uts_ns.name.nodename);
 	size_t maxlen  = bufsize - 1;
-	ssize_t arglen;
 
 	if (!arg)
 		return -EINVAL;
 
-	arglen = strscpy(init_uts_ns.name.nodename, arg, bufsize);
-	if (arglen < 0) {
-		pr_warn("hostname parameter exceeds %zd characters and will be truncated",
+	if (strscpy(init_uts_ns.name.nodename, arg, bufsize) < 0)
+		pr_warn("hostname parameter exceeds %zu characters and will be truncated\n",
 			maxlen);
-	}
+
 	return 0;
 }
 early_param("hostname", early_hostname);
_

Patches currently in -mm which might be from blum@kernel.org are

init-fix-early-boot-crash-with-bare-hostname-parameter.patch
init-simplify-early_hostname.patch


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-08-28 18:26 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-28 18:26 + init-simplify-early_hostname.patch added to mm-nonmm-unstable branch Andrew Morton

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.