All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1] powerpc: Fix off-by-one bug
@ 2026-11-14 20:10 Alejandro Colomar
  2026-11-15  5:47 ` Ritesh Harjani
  0 siblings, 1 reply; 3+ messages in thread
From: Alejandro Colomar @ 2026-11-14 20:10 UTC (permalink / raw)
  To: linuxppc-dev
  Cc: Alejandro Colomar, linux-hardening, alx+linux-hardening,
	Nicholas Piggin, Mauricio Faria de Oliveira, Michael Neuling,
	Michal Suchánek, Michael Ellerman, Linus Torvalds

[-- 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 --]

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-11-15  8:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-14 20:10 [PATCH v1] powerpc: Fix off-by-one bug Alejandro Colomar
2026-11-15  5:47 ` Ritesh Harjani
2026-11-15  8:09   ` Alejandro Colomar

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.