[PATCH] fs/resctrl: avoid redundant call to strlen() in schemata_list_add()

Dmitry Antipov posted 1 patch 3 months, 2 weeks ago
fs/resctrl/rdtgroup.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] fs/resctrl: avoid redundant call to strlen() in schemata_list_add()
Posted by Dmitry Antipov 3 months, 2 weeks ago
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@yandex.ru>
---
 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