2018-09-21 02:00:24

by zhong jiang

[permalink] [raw]
Subject: [RESEND PATCH] error-injection: remove meaningless null pointer check before debugfs_remove_recursive

debugfs_remove_recursive has taken the null pointer into account.
just remove the null check before debugfs_remove_recursive.

Acked-by: Masami Hiramatsu <[email protected]>
Signed-off-by: zhong jiang <[email protected]>
---
kernel/fail_function.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/kernel/fail_function.c b/kernel/fail_function.c
index bc80a4e..17f75b5 100644
--- a/kernel/fail_function.c
+++ b/kernel/fail_function.c
@@ -173,8 +173,7 @@ static void fei_debugfs_remove_attr(struct fei_attr *attr)
struct dentry *dir;

dir = debugfs_lookup(attr->kp.symbol_name, fei_debugfs_dir);
- if (dir)
- debugfs_remove_recursive(dir);
+ debugfs_remove_recursive(dir);
}

static int fei_kprobe_handler(struct kprobe *kp, struct pt_regs *regs)
--
1.7.12.4



2018-09-21 04:49:52

by Kees Cook

[permalink] [raw]
Subject: Re: [RESEND PATCH] error-injection: remove meaningless null pointer check before debugfs_remove_recursive

On Thu, Sep 20, 2018 at 6:46 PM, zhong jiang <[email protected]> wrote:
> debugfs_remove_recursive has taken the null pointer into account.
> just remove the null check before debugfs_remove_recursive.
>
> Acked-by: Masami Hiramatsu <[email protected]>
> Signed-off-by: zhong jiang <[email protected]>

Acked-by: Kees Cook <[email protected]>

-Kees

> ---
> kernel/fail_function.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/kernel/fail_function.c b/kernel/fail_function.c
> index bc80a4e..17f75b5 100644
> --- a/kernel/fail_function.c
> +++ b/kernel/fail_function.c
> @@ -173,8 +173,7 @@ static void fei_debugfs_remove_attr(struct fei_attr *attr)
> struct dentry *dir;
>
> dir = debugfs_lookup(attr->kp.symbol_name, fei_debugfs_dir);
> - if (dir)
> - debugfs_remove_recursive(dir);
> + debugfs_remove_recursive(dir);
> }
>
> static int fei_kprobe_handler(struct kprobe *kp, struct pt_regs *regs)
> --
> 1.7.12.4
>



--
Kees Cook
Pixel Security