[PATCH 1/4] kcsan, debugfs: Remove redundant call of kallsyms_lookup_name()

ran xiaokai posted 4 patches 2 months ago
[PATCH 1/4] kcsan, debugfs: Remove redundant call of kallsyms_lookup_name()
Posted by ran xiaokai 2 months ago
From: Ran Xiaokai <ran.xiaokai@zte.com.cn>

There is no need to repeatedly call kallsyms_lookup_name, we can
reuse the return value of this function.

Signed-off-by: Ran Xiaokai <ran.xiaokai@zte.com.cn>
---
 kernel/kcsan/debugfs.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/kernel/kcsan/debugfs.c b/kernel/kcsan/debugfs.c
index 53b21ae30e00..ed483987869e 100644
--- a/kernel/kcsan/debugfs.c
+++ b/kernel/kcsan/debugfs.c
@@ -181,8 +181,7 @@ static ssize_t insert_report_filterlist(const char *func)
 	}
 
 	/* Note: deduplicating should be done in userspace. */
-	report_filterlist.addrs[report_filterlist.used++] =
-		kallsyms_lookup_name(func);
+	report_filterlist.addrs[report_filterlist.used++] = addr;
 	report_filterlist.sorted = false;
 
 out:
-- 
2.15.2
Re: [PATCH 1/4] kcsan, debugfs: Remove redundant call of kallsyms_lookup_name()
Posted by Marco Elver 1 month, 4 weeks ago
On Wed, 25 Sept 2024 at 16:32, ran xiaokai <ranxiaokai627@163.com> wrote:
>
> From: Ran Xiaokai <ran.xiaokai@zte.com.cn>
>
> There is no need to repeatedly call kallsyms_lookup_name, we can
> reuse the return value of this function.
>
> Signed-off-by: Ran Xiaokai <ran.xiaokai@zte.com.cn>

Reviewed-by: Marco Elver <elver@google.com>



> ---
>  kernel/kcsan/debugfs.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/kernel/kcsan/debugfs.c b/kernel/kcsan/debugfs.c
> index 53b21ae30e00..ed483987869e 100644
> --- a/kernel/kcsan/debugfs.c
> +++ b/kernel/kcsan/debugfs.c
> @@ -181,8 +181,7 @@ static ssize_t insert_report_filterlist(const char *func)
>         }
>
>         /* Note: deduplicating should be done in userspace. */
> -       report_filterlist.addrs[report_filterlist.used++] =
> -               kallsyms_lookup_name(func);
> +       report_filterlist.addrs[report_filterlist.used++] = addr;
>         report_filterlist.sorted = false;
>
>  out:
> --
> 2.15.2
>
>