From nobody Mon May 25 02:41:45 2026 Received: from out-173.mta1.migadu.com (out-173.mta1.migadu.com [95.215.58.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4F7733403FC for ; Tue, 19 May 2026 13:02:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779195740; cv=none; b=iJCoHN7D7hYuwWAyN3J7LShgU9J2nnQiD5gKb3dMDUVkTKIsL+56El8CLmLw6Dw4aFbOMqbPLRPq9nV4Hgv5OIJTCudCt64NJ02cxb6BhLCVbdYwa1CPOuU5SZcGf8y9IrTdBogvCZWPYvXk35MVXQHqdJPcHLSukutrbj64d3M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779195740; c=relaxed/simple; bh=zGT9NHJWxDgdN5EpBRX6QDKeBDLcs8iqDU9SIcQ05q0=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=RI/N5/zWucjX8M1p9vB/KQtA8KzZ5MCR92xArkd+Q+6jDYaAEpayeFZFbutqC/OmVTkeLoufIbD++hiLSQHGuxUTfg3diw6759FWyqRD1fCtwg2sm6K6yOYnIPNVweeG8nMiwiUTafHBeub4OJikI5ZWgrEikIoYr8nydQR6cR8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=RLsiteex; arc=none smtp.client-ip=95.215.58.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="RLsiteex" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1779195735; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=S60l7rp2jexw873mcSZMWTi+lccK0bnkd5kQoQ89qL0=; b=RLsiteexK1tCMz987Nm+CEgDbYwjP8GN3eF9vzMz1j9Pcy4tEiZtbaiRiQ5xXEz7uIb3kF WZQrH8J/A23Y+2L3Gj6WE9lStlHeSNJMmCeCM2tw5x2mF6HUAEv6EyFKujk4stVtCo03Dd cprVEDuX9c9th8brT/dT18zZkNM8CDc= From: Kaitao Cheng To: akpm@linux-foundation.org, pmladek@suse.com, rostedt@goodmis.org, andriy.shevchenko@linux.intel.com, linux@rasmusvillemoes.dk, senozhatsky@chromium.org Cc: linux-kernel@vger.kernel.org, Kaitao Cheng Subject: [PATCH] lib/vsprintf: Require exact hash_pointers mode matches Date: Tue, 19 May 2026 21:01:17 +0800 Message-ID: <20260519130117.48097-1-kaitao.cheng@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset="utf-8" From: Kaitao Cheng hash_pointers=3D accepts a small set of mode strings, but the parser uses strncmp() with the length of each valid mode. That accepts values with trailing garbage, such as hash_pointers=3Dautobots or hash_pointers=3Dnevermind, as valid aliases for auto and never. Use strcmp() so that only the documented mode strings are accepted. Invalid values will continue to fall back to auto through the existing unknown-mode path. Signed-off-by: Kaitao Cheng Reviewed-by: Petr Mladek --- lib/vsprintf.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/vsprintf.c b/lib/vsprintf.c index 9ca676feb8eb..03e87b933fd0 100644 --- a/lib/vsprintf.c +++ b/lib/vsprintf.c @@ -2354,13 +2354,13 @@ static int __init hash_pointers_mode_parse(char *st= r) if (!str) { pr_warn("Hash pointers mode empty; falling back to auto.\n"); hash_pointers_mode =3D HASH_PTR_AUTO; - } else if (strncmp(str, "auto", 4) =3D=3D 0) { + } else if (strcmp(str, "auto") =3D=3D 0) { pr_info("Hash pointers mode set to auto.\n"); hash_pointers_mode =3D HASH_PTR_AUTO; - } else if (strncmp(str, "never", 5) =3D=3D 0) { + } else if (strcmp(str, "never") =3D=3D 0) { pr_info("Hash pointers mode set to never.\n"); hash_pointers_mode =3D HASH_PTR_NEVER; - } else if (strncmp(str, "always", 6) =3D=3D 0) { + } else if (strcmp(str, "always") =3D=3D 0) { pr_info("Hash pointers mode set to always.\n"); hash_pointers_mode =3D HASH_PTR_ALWAYS; } else { --=20 2.50.1 (Apple Git-155)