linux-security-module.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] apparmor: fix odd_ptr_err.cocci warnings (fwd)
@ 2019-10-24 11:28 Julia Lawall
  2019-10-24 18:35 ` Navid Emamdoost
  0 siblings, 1 reply; 4+ messages in thread
From: Julia Lawall @ 2019-10-24 11:28 UTC (permalink / raw)
  To: Navid Emamdoost
  Cc: john.johansen, emamd001, smccaman, kjlu, James Morris,
	Serge E. Hallyn, linux-security-module, linux-kernel, emamd001,
	smccaman, kjlu

Hello,

The change suggested by Coccinelle is not correct, but the original code
is not correct either because the argument to PTR_ERR should be a pointer,
not an integer.

julia

---------- Forwarded message ----------
Date: Thu, 24 Oct 2019 18:21:57 +0800
From: kbuild test robot <lkp@intel.com>
To: kbuild@lists.01.org
Cc: Julia Lawall <julia.lawall@lip6.fr>
Subject: [PATCH] apparmor: fix odd_ptr_err.cocci warnings

CC: kbuild-all@lists.01.org
In-Reply-To: <20191021152348.3906-1-navid.emamdoost@gmail.com>
References: <20191021152348.3906-1-navid.emamdoost@gmail.com>
TO: Navid Emamdoost <navid.emamdoost@gmail.com>

From: kbuild test robot <lkp@intel.com>

security/apparmor/audit.c:199:5-11: inconsistent IS_ERR and PTR_ERR on line 202.

 PTR_ERR should access the value just tested by IS_ERR

Semantic patch information:
 There can be false positives in the patch case, where it is the call to
 IS_ERR that is wrong.

Generated by: scripts/coccinelle/tests/odd_ptr_err.cocci

Fixes: 6f939f24599c ("apparmor: Fix use-after-free in aa_audit_rule_init")
CC: Navid Emamdoost <navid.emamdoost@gmail.com>
Signed-off-by: kbuild test robot <lkp@intel.com>
---

url:    https://github.com/0day-ci/linux/commits/Navid-Emamdoost/apparmor-Fix-use-after-free-in-aa_audit_rule_init/20191024-123239
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security.git next-testing
:::::: branch date: 6 hours ago
:::::: commit date: 6 hours ago

Please take the patch only if it's a positive warning. Thanks!

 audit.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/security/apparmor/audit.c
+++ b/security/apparmor/audit.c
@@ -199,7 +199,7 @@ int aa_audit_rule_init(u32 field, u32 op
 	if (IS_ERR(rule->label)) {
 		int err = rule->label;
 		aa_audit_rule_free(rule);
-		return PTR_ERR(err);
+		return PTR_ERR(rule->label);
 	}

 	*vrule = rule;

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] apparmor: fix odd_ptr_err.cocci warnings (fwd)
  2019-10-24 11:28 [PATCH] apparmor: fix odd_ptr_err.cocci warnings (fwd) Julia Lawall
@ 2019-10-24 18:35 ` Navid Emamdoost
  2019-10-24 18:39   ` Julia Lawall
  2019-10-24 18:39   ` Tyler Hicks
  0 siblings, 2 replies; 4+ messages in thread
From: Navid Emamdoost @ 2019-10-24 18:35 UTC (permalink / raw)
  To: Julia Lawall
  Cc: John Johansen, Navid Emamdoost, Stephen McCamant, Kangjie Lu,
	James Morris, Serge E. Hallyn, linux-security-module, LKML,
	Tyler Hicks

Hello,

I added Tyler to this conversation.
I believe v3 of the patch addresses this issue:
https://lore.kernel.org/patchwork/patch/1142523/


On Thu, Oct 24, 2019 at 6:28 AM Julia Lawall <julia.lawall@lip6.fr> wrote:
>
> Hello,
>
> The change suggested by Coccinelle is not correct, but the original code
> is not correct either because the argument to PTR_ERR should be a pointer,
> not an integer.
>
> julia
>
> ---------- Forwarded message ----------
> Date: Thu, 24 Oct 2019 18:21:57 +0800
> From: kbuild test robot <lkp@intel.com>
> To: kbuild@lists.01.org
> Cc: Julia Lawall <julia.lawall@lip6.fr>
> Subject: [PATCH] apparmor: fix odd_ptr_err.cocci warnings
>
> CC: kbuild-all@lists.01.org
> In-Reply-To: <20191021152348.3906-1-navid.emamdoost@gmail.com>
> References: <20191021152348.3906-1-navid.emamdoost@gmail.com>
> TO: Navid Emamdoost <navid.emamdoost@gmail.com>
>
> From: kbuild test robot <lkp@intel.com>
>
> security/apparmor/audit.c:199:5-11: inconsistent IS_ERR and PTR_ERR on line 202.
>
>  PTR_ERR should access the value just tested by IS_ERR
>
> Semantic patch information:
>  There can be false positives in the patch case, where it is the call to
>  IS_ERR that is wrong.
>
> Generated by: scripts/coccinelle/tests/odd_ptr_err.cocci
>
> Fixes: 6f939f24599c ("apparmor: Fix use-after-free in aa_audit_rule_init")
> CC: Navid Emamdoost <navid.emamdoost@gmail.com>
> Signed-off-by: kbuild test robot <lkp@intel.com>
> ---
>
> url:    https://github.com/0day-ci/linux/commits/Navid-Emamdoost/apparmor-Fix-use-after-free-in-aa_audit_rule_init/20191024-123239
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security.git next-testing
> :::::: branch date: 6 hours ago
> :::::: commit date: 6 hours ago
>
> Please take the patch only if it's a positive warning. Thanks!
>
>  audit.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> --- a/security/apparmor/audit.c
> +++ b/security/apparmor/audit.c
> @@ -199,7 +199,7 @@ int aa_audit_rule_init(u32 field, u32 op
>         if (IS_ERR(rule->label)) {
>                 int err = rule->label;
>                 aa_audit_rule_free(rule);
> -               return PTR_ERR(err);
> +               return PTR_ERR(rule->label);
>         }
>
>         *vrule = rule;



--
Navid.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] apparmor: fix odd_ptr_err.cocci warnings (fwd)
  2019-10-24 18:35 ` Navid Emamdoost
@ 2019-10-24 18:39   ` Julia Lawall
  2019-10-24 18:39   ` Tyler Hicks
  1 sibling, 0 replies; 4+ messages in thread
From: Julia Lawall @ 2019-10-24 18:39 UTC (permalink / raw)
  To: Navid Emamdoost
  Cc: John Johansen, Navid Emamdoost, Stephen McCamant, Kangjie Lu,
	James Morris, Serge E. Hallyn, linux-security-module, LKML,
	Tyler Hicks



On Thu, 24 Oct 2019, Navid Emamdoost wrote:

> Hello,
>
> I added Tyler to this conversation.
> I believe v3 of the patch addresses this issue:
> https://lore.kernel.org/patchwork/patch/1142523/

It looks ok like that, thanks.

Please don't top post.

julia

>
>
> On Thu, Oct 24, 2019 at 6:28 AM Julia Lawall <julia.lawall@lip6.fr> wrote:
> >
> > Hello,
> >
> > The change suggested by Coccinelle is not correct, but the original code
> > is not correct either because the argument to PTR_ERR should be a pointer,
> > not an integer.
> >
> > julia
> >
> > ---------- Forwarded message ----------
> > Date: Thu, 24 Oct 2019 18:21:57 +0800
> > From: kbuild test robot <lkp@intel.com>
> > To: kbuild@lists.01.org
> > Cc: Julia Lawall <julia.lawall@lip6.fr>
> > Subject: [PATCH] apparmor: fix odd_ptr_err.cocci warnings
> >
> > CC: kbuild-all@lists.01.org
> > In-Reply-To: <20191021152348.3906-1-navid.emamdoost@gmail.com>
> > References: <20191021152348.3906-1-navid.emamdoost@gmail.com>
> > TO: Navid Emamdoost <navid.emamdoost@gmail.com>
> >
> > From: kbuild test robot <lkp@intel.com>
> >
> > security/apparmor/audit.c:199:5-11: inconsistent IS_ERR and PTR_ERR on line 202.
> >
> >  PTR_ERR should access the value just tested by IS_ERR
> >
> > Semantic patch information:
> >  There can be false positives in the patch case, where it is the call to
> >  IS_ERR that is wrong.
> >
> > Generated by: scripts/coccinelle/tests/odd_ptr_err.cocci
> >
> > Fixes: 6f939f24599c ("apparmor: Fix use-after-free in aa_audit_rule_init")
> > CC: Navid Emamdoost <navid.emamdoost@gmail.com>
> > Signed-off-by: kbuild test robot <lkp@intel.com>
> > ---
> >
> > url:    https://github.com/0day-ci/linux/commits/Navid-Emamdoost/apparmor-Fix-use-after-free-in-aa_audit_rule_init/20191024-123239
> > base:   https://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security.git next-testing
> > :::::: branch date: 6 hours ago
> > :::::: commit date: 6 hours ago
> >
> > Please take the patch only if it's a positive warning. Thanks!
> >
> >  audit.c |    2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > --- a/security/apparmor/audit.c
> > +++ b/security/apparmor/audit.c
> > @@ -199,7 +199,7 @@ int aa_audit_rule_init(u32 field, u32 op
> >         if (IS_ERR(rule->label)) {
> >                 int err = rule->label;
> >                 aa_audit_rule_free(rule);
> > -               return PTR_ERR(err);
> > +               return PTR_ERR(rule->label);
> >         }
> >
> >         *vrule = rule;
>
>
>
> --
> Navid.
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] apparmor: fix odd_ptr_err.cocci warnings (fwd)
  2019-10-24 18:35 ` Navid Emamdoost
  2019-10-24 18:39   ` Julia Lawall
@ 2019-10-24 18:39   ` Tyler Hicks
  1 sibling, 0 replies; 4+ messages in thread
From: Tyler Hicks @ 2019-10-24 18:39 UTC (permalink / raw)
  To: Navid Emamdoost
  Cc: Julia Lawall, John Johansen, Navid Emamdoost, Stephen McCamant,
	Kangjie Lu, James Morris, Serge E. Hallyn, linux-security-module,
	LKML

On 2019-10-24 13:35:24, Navid Emamdoost wrote:
> Hello,
> 
> I added Tyler to this conversation.
> I believe v3 of the patch addresses this issue:
> https://lore.kernel.org/patchwork/patch/1142523/

Yes, I agree. v3 is the fix.

Tyler

> 
> 
> On Thu, Oct 24, 2019 at 6:28 AM Julia Lawall <julia.lawall@lip6.fr> wrote:
> >
> > Hello,
> >
> > The change suggested by Coccinelle is not correct, but the original code
> > is not correct either because the argument to PTR_ERR should be a pointer,
> > not an integer.
> >
> > julia
> >
> > ---------- Forwarded message ----------
> > Date: Thu, 24 Oct 2019 18:21:57 +0800
> > From: kbuild test robot <lkp@intel.com>
> > To: kbuild@lists.01.org
> > Cc: Julia Lawall <julia.lawall@lip6.fr>
> > Subject: [PATCH] apparmor: fix odd_ptr_err.cocci warnings
> >
> > CC: kbuild-all@lists.01.org
> > In-Reply-To: <20191021152348.3906-1-navid.emamdoost@gmail.com>
> > References: <20191021152348.3906-1-navid.emamdoost@gmail.com>
> > TO: Navid Emamdoost <navid.emamdoost@gmail.com>
> >
> > From: kbuild test robot <lkp@intel.com>
> >
> > security/apparmor/audit.c:199:5-11: inconsistent IS_ERR and PTR_ERR on line 202.
> >
> >  PTR_ERR should access the value just tested by IS_ERR
> >
> > Semantic patch information:
> >  There can be false positives in the patch case, where it is the call to
> >  IS_ERR that is wrong.
> >
> > Generated by: scripts/coccinelle/tests/odd_ptr_err.cocci
> >
> > Fixes: 6f939f24599c ("apparmor: Fix use-after-free in aa_audit_rule_init")
> > CC: Navid Emamdoost <navid.emamdoost@gmail.com>
> > Signed-off-by: kbuild test robot <lkp@intel.com>
> > ---
> >
> > url:    https://github.com/0day-ci/linux/commits/Navid-Emamdoost/apparmor-Fix-use-after-free-in-aa_audit_rule_init/20191024-123239
> > base:   https://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security.git next-testing
> > :::::: branch date: 6 hours ago
> > :::::: commit date: 6 hours ago
> >
> > Please take the patch only if it's a positive warning. Thanks!
> >
> >  audit.c |    2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > --- a/security/apparmor/audit.c
> > +++ b/security/apparmor/audit.c
> > @@ -199,7 +199,7 @@ int aa_audit_rule_init(u32 field, u32 op
> >         if (IS_ERR(rule->label)) {
> >                 int err = rule->label;
> >                 aa_audit_rule_free(rule);
> > -               return PTR_ERR(err);
> > +               return PTR_ERR(rule->label);
> >         }
> >
> >         *vrule = rule;
> 
> 
> 
> --
> Navid.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-10-24 18:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-10-24 11:28 [PATCH] apparmor: fix odd_ptr_err.cocci warnings (fwd) Julia Lawall
2019-10-24 18:35 ` Navid Emamdoost
2019-10-24 18:39   ` Julia Lawall
2019-10-24 18:39   ` Tyler Hicks

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).