Skip to contentSkip to conversation

gcov: use kzalloc_flex() for allocation

PATCH New Rosen Penev 1 participant 1 message May 19 Gcov based kernel profiling

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gcov: use kzalloc_flex() for allocation

name[] is a flexible array member and kzalloc_flex() is the proper helper to handle it.

---
 kernel/gcov/fs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/gcov/fs.c +1 -1
index 1d19b1be207a..ad9c0ac8a709 100644
@@ -541,7 +541,7 @@ static struct gcov_node *new_node(struct gcov_node *parent,
 {
 	struct gcov_node *node;
 
-	node = kzalloc(sizeof(struct gcov_node) + strlen(name) + 1, GFP_KERNEL);
+	node = kzalloc_flex(*node, name, strlen(name) + 1);
 	if (!node)
 		goto err_nomem;
 	if (info) {
Signature · 1 line
2.54.0