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

From: Leon Romanovsky
Date: Wed Sep 02 2020 - 04:55:40 EST


From: Leon Romanovsky <leonro@xxxxxxxxxx>

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@xxxxxxxxxxxxx>
Signed-off-by: Leon Romanovsky <leonro@xxxxxxxxxx>
---
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