Skip to content

Commit 8cc27f5

Browse files
author
Georgi Djakov
committed
interconnect: debugfs: initialize src_node and dst_node to empty strings
The debugfs_create_str() API assumes that the string pointer is either NULL or points to valid kmalloc() memory. Leaving the pointer uninitialized can cause problems. Initialize src_node and dst_node to empty strings before creating the debugfs entries to guarantee that reads and writes are safe. Fixes: 770c69f ("interconnect: Add debugfs test client") Signed-off-by: Georgi Djakov <djakov@kernel.org> Reviewed-by: Kuan-Wei Chiu <visitorckw@gmail.com> Tested-by: Kuan-Wei Chiu <visitorckw@gmail.com> Link: https://lore.kernel.org/r/20260109122523.125843-1-djakov@kernel.org Signed-off-by: Georgi Djakov <djakov@kernel.org>
1 parent a305df4 commit 8cc27f5

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

drivers/interconnect/debugfs-client.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,11 @@ int icc_debugfs_client_init(struct dentry *icc_dir)
150150
return ret;
151151
}
152152

153+
src_node = devm_kstrdup(&pdev->dev, "", GFP_KERNEL);
154+
dst_node = devm_kstrdup(&pdev->dev, "", GFP_KERNEL);
155+
if (!src_node || !dst_node)
156+
return -ENOMEM;
157+
153158
client_dir = debugfs_create_dir("test_client", icc_dir);
154159

155160
debugfs_create_str("src_node", 0600, client_dir, &src_node);

0 commit comments

Comments
 (0)