LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] powerpc/pseries: Simplify attribute description check in papr_init()
@ 2026-06-26 11:07 Thorsten Blum
  2026-08-03  6:57 ` Madhavan Srinivasan
  0 siblings, 1 reply; 2+ messages in thread
From: Thorsten Blum @ 2026-06-26 11:07 UTC (permalink / raw)
  To: Madhavan Srinivasan, Michael Ellerman, Nicholas Piggin,
	Christophe Leroy (CS GROUP), Kees Cook
  Cc: Thorsten Blum, linuxppc-dev, linux-kernel

Check only the first byte instead of scanning the entire string with
strnlen().

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
 arch/powerpc/platforms/pseries/papr_platform_attributes.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/arch/powerpc/platforms/pseries/papr_platform_attributes.c b/arch/powerpc/platforms/pseries/papr_platform_attributes.c
index c6159870de0e..ff8adda02341 100644
--- a/arch/powerpc/platforms/pseries/papr_platform_attributes.c
+++ b/arch/powerpc/platforms/pseries/papr_platform_attributes.c
@@ -325,12 +325,8 @@ static int __init papr_init(void)
 	}
 
 	for (idx = 0; idx < num_attrs; idx++) {
-		bool show_val_desc = true;
-
 		/* Do not add the value desc attr if it does not exist */
-		if (strnlen(esi_attrs[idx].value_desc,
-			    sizeof(esi_attrs[idx].value_desc)) == 0)
-			show_val_desc = false;
+		bool show_val_desc = *esi_attrs[idx].value_desc != '\0';
 
 		if (add_attr_group(be64_to_cpu(esi_attrs[idx].id),
 				   &papr_groups[idx],


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

* Re: [PATCH] powerpc/pseries: Simplify attribute description check in papr_init()
  2026-06-26 11:07 [PATCH] powerpc/pseries: Simplify attribute description check in papr_init() Thorsten Blum
@ 2026-08-03  6:57 ` Madhavan Srinivasan
  0 siblings, 0 replies; 2+ messages in thread
From: Madhavan Srinivasan @ 2026-08-03  6:57 UTC (permalink / raw)
  To: Michael Ellerman, Nicholas Piggin, Christophe Leroy (CS GROUP),
	Kees Cook, Thorsten Blum
  Cc: linuxppc-dev, linux-kernel

On Fri, 26 Jun 2026 13:07:18 +0200, Thorsten Blum wrote:
> Check only the first byte instead of scanning the entire string with
> strnlen().
> 
> 

Applied to powerpc/next.

[1/1] powerpc/pseries: Simplify attribute description check in papr_init()
      https://git.kernel.org/powerpc/c/7cc3d3fdc97fa32f1e1d7b15810e723fe524b0f8

cheers


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

end of thread, other threads:[~2026-08-03  6:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-26 11:07 [PATCH] powerpc/pseries: Simplify attribute description check in papr_init() Thorsten Blum
2026-08-03  6:57 ` Madhavan Srinivasan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox