[PATCH] fs/resctrl: avoid redundant call to strlen() in schemata_list_add()
From: Dmitry Antipov
Date: Mon Oct 27 2025 - 09:49:25 EST
Since 'snprintf()' returns the number of characters emitted and an
overflow case is handled explicitly, an extra call to 'strlen()' in
'schemata_list_add()' may be dropped. Compile tested only.
Signed-off-by: Dmitry Antipov <dmantipov@xxxxxxxxx>
---
fs/resctrl/rdtgroup.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/resctrl/rdtgroup.c b/fs/resctrl/rdtgroup.c
index 0320360cd7a6..6f6ef6c4cac3 100644
--- a/fs/resctrl/rdtgroup.c
+++ b/fs/resctrl/rdtgroup.c
@@ -2646,7 +2646,7 @@ static int schemata_list_add(struct rdt_resource *r, enum resctrl_conf_type type
return -EINVAL;
}
- cl = strlen(s->name);
+ cl = ret;
/*
* If CDP is supported by this resource, but not enabled,
--
2.51.0