LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Alejandro Colomar <alx@kernel.org>
To: linuxppc-dev@lists.ozlabs.org
Cc: "Alejandro Colomar" <alx@kernel.org>,
	linux-hardening@vger.kernel.org, alx+linux-hardening@kernel.org,
	"Nicholas Piggin" <npiggin@gmail.com>,
	"Mauricio Faria de Oliveira" <mauricfo@linux.vnet.ibm.com>,
	"Michael Neuling" <mikey@neuling.org>,
	"Michal Suchánek" <msuchanek@suse.de>,
	"Michael Ellerman" <mpe@ellerman.id.au>,
	"Linus Torvalds" <torvalds@linux-foundation.org>
Subject: [PATCH v1] powerpc: Fix off-by-one bug
Date: Sat, 14 Nov 2026 21:10:58 +0100	[thread overview]
Message-ID: <1f7d29cebba5823400ad0bc5d95610f05f55e2d0.1794686962.git.alx@kernel.org> (raw)

[-- Attachment #1: Type: text/plain, Size: 1183 bytes --]

From the surrounding similar calls, the intention seems obvious: this
seems intended to check for a prefix.

However, I do not understand this code, so take my reading with a grain
of salt.

Fixes: a048a07d7f453 ("powerpc/64s: Add support for a store forwarding barrier at kernel entry/exit")
Signed-off-by: Alejandro Colomar <alx@kernel.org>
---

I found this while looking into replacing this code with calls to
strprefix().

 arch/powerpc/kernel/security.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/kernel/security.c b/arch/powerpc/kernel/security.c
index 600596cb4ffb..37999555bfe6 100644
--- a/arch/powerpc/kernel/security.c
+++ b/arch/powerpc/kernel/security.c
@@ -273,7 +273,7 @@ enum stf_barrier_type stf_barrier_type_get(void)
 /* This is the generic flag used by other architectures */
 static int __init handle_ssbd(char *p)
 {
-	if (!p || strncmp(p, "auto", 5) == 0 || strncmp(p, "on", 2) == 0 ) {
+	if (!p || strncmp(p, "auto", 4) == 0 || strncmp(p, "on", 2) == 0 ) {
 		/* Until firmware tells us, we have the barrier with auto */
 		return 0;
 	} else if (strncmp(p, "off", 3) == 0) {
-- 
2.55.0


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

             reply	other threads:[~2026-11-14 20:11 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-14 20:10 Alejandro Colomar [this message]
2026-11-15  5:47 ` [PATCH v1] powerpc: Fix off-by-one bug Ritesh Harjani
2026-11-15  8:09   ` Alejandro Colomar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1f7d29cebba5823400ad0bc5d95610f05f55e2d0.1794686962.git.alx@kernel.org \
    --to=alx@kernel.org \
    --cc=alx+linux-hardening@kernel.org \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mauricfo@linux.vnet.ibm.com \
    --cc=mikey@neuling.org \
    --cc=mpe@ellerman.id.au \
    --cc=msuchanek@suse.de \
    --cc=npiggin@gmail.com \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox