diff mbox series

[linux-next] smack: lsm: remove the unneeded result variable

Message ID 20220912100535.18125-1-xu.panda@zte.com.cn (mailing list archive)
State Handled Elsewhere
Headers show
Series [linux-next] smack: lsm: remove the unneeded result variable | expand

Commit Message

CGEL Sept. 12, 2022, 10:05 a.m. UTC
From: Xu Panda <xu.panda@zte.com.cn>

Return the value smk_ptrace_rule_check() directly instead of storing it
in another redundant variable.

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Xu Panda <xu.panda@zte.com.cn>
---
 security/smack/smack_lsm.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Comments

Casey Schaufler Sept. 12, 2022, 5 p.m. UTC | #1
On 9/12/2022 3:05 AM, cgel.zte@gmail.com wrote:
> From: Xu Panda <xu.panda@zte.com.cn>
>
> Return the value smk_ptrace_rule_check() directly instead of storing it
> in another redundant variable.
>
> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: Xu Panda <xu.panda@zte.com.cn>

Added to https://github.com/cschaufler/smack-next#next.
Thank you.

> ---
>  security/smack/smack_lsm.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c
> index 16e24a6cdc7c..b6306d71c908 100644
> --- a/security/smack/smack_lsm.c
> +++ b/security/smack/smack_lsm.c
> @@ -497,13 +497,11 @@ static int smack_ptrace_access_check(struct task_struct *ctp, unsigned int mode)
>   */
>  static int smack_ptrace_traceme(struct task_struct *ptp)
>  {
> -       int rc;
>         struct smack_known *skp;
>
>         skp = smk_of_task(smack_cred(current_cred()));
>
> -       rc = smk_ptrace_rule_check(ptp, skp, PTRACE_MODE_ATTACH, __func__);
> -       return rc;
> +       return smk_ptrace_rule_check(ptp, skp, PTRACE_MODE_ATTACH, __func__);
>  }
>
>  /**
diff mbox series

Patch

diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c
index 16e24a6cdc7c..b6306d71c908 100644
--- a/security/smack/smack_lsm.c
+++ b/security/smack/smack_lsm.c
@@ -497,13 +497,11 @@  static int smack_ptrace_access_check(struct task_struct *ctp, unsigned int mode)
  */
 static int smack_ptrace_traceme(struct task_struct *ptp)
 {
-       int rc;
        struct smack_known *skp;

        skp = smk_of_task(smack_cred(current_cred()));

-       rc = smk_ptrace_rule_check(ptp, skp, PTRACE_MODE_ATTACH, __func__);
-       return rc;
+       return smk_ptrace_rule_check(ptp, skp, PTRACE_MODE_ATTACH, __func__);
 }

 /**