[PATCH rdma-next 2/4] gcov: Use proper duplication routine for const pointer

Leon Romanovsky
2020-09-02T08:55:41Z

From: Leon Romanovsky <leonro@nvidia.com>

The filename is a const pointer, so use the proper string duplication
routine that takes into account const identifier.

Cc: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
---
kernel/gcov/gcc_4_7.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/gcov/gcc_4_7.c b/kernel/gcov/gcc_4_7.c
index 6d706c5eed5c..318211deb903 100644
--- a/kernel/gcov/gcc_4_7.c
+++ b/kernel/gcov/gcc_4_7.c
@@ -283,7 +283,7 @@ struct gcov_info *gcov_info_dup(struct gcov_info *info)
dup->merge[fi_idx] = info->merge[fi_idx];
dup->n_functions = info->n_functions;

- dup->filename = kstrdup(info->filename, GFP_KERNEL);
+ dup->filename = kstrdup_const(info->filename, GFP_KERNEL);
if (!dup->filename)
goto err_free;

@@ -359,7 +359,7 @@ void gcov_info_free(struct gcov_info *info)

free_info:
kfree(info->functions);
- kfree(info->filename);
+ kfree_const(info->filename);
kfree(info);
}

--
2.26.2