All of lore.kernel.org
 help / color / mirror / Atom feed
* [Cocci] [PATCH] coccinelle: api: check for propagation of error from platform_get_irq
@ 2015-12-26 19:24 ` Julia Lawall
  0 siblings, 0 replies; 51+ messages in thread
From: Julia Lawall @ 2015-12-26 19:24 UTC (permalink / raw)
  To: cocci

The error return value of platform_get_irq seems to often get dropped.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---
 scripts/coccinelle/api/platform_get_irq_return.cocci |   53 ++++++++++
 1 file changed, 53 insertions(+)

diff --git a/scripts/coccinelle/api/platform_get_irq_return.cocci b/scripts/coccinelle/api/platform_get_irq_return.cocci
new file mode 100644
index 0000000..96fc560
--- /dev/null
+++ b/scripts/coccinelle/api/platform_get_irq_return.cocci
@@ -0,0 +1,53 @@
+/// Propagate the return value of platform_get_irq.
+//# Sometimes the return value of platform_get_irq is tested using <= 0, but 0
+//# might not be an appropriate return value in an error case.
+///
+// Confidence: Moderate
+// Copyright: (C) 2015 Julia Lawall, Inria. GPLv2.
+// URL: http://coccinelle.lip6.fr/
+// Options: --no-includes --include-headers
+
+virtual context
+virtual org
+virtual report
+
+// ----------------------------------------------------------------------------
+
+ at r depends on context || org || report@
+constant C;
+expression e, ret;
+position j0, j1, j2;
+@@
+
+* e at j0 = platform_get_irq(...);
+if (...) {
+  ...
+  ret at j1 = -C;
+  ...
+  return ret at j2;
+}
+
+// ----------------------------------------------------------------------------
+
+ at script:python r_org depends on org@
+j0 << r.j0;
+j1 << r.j1;
+j2 << r.j2;
+@@
+
+msg = "Propagate return value of platform_get_irq."
+coccilib.org.print_todo(j0[0], msg)
+coccilib.org.print_link(j1[0], "")
+coccilib.org.print_link(j2[0], "")
+
+// ----------------------------------------------------------------------------
+
+@script:python r_report depends on report@
+j0 << r.j0;
+j1 << r.j1;
+j2 << r.j2;
+@@
+
+msg = "Propagate return value of platform_get_irq around lines %s,%s." % (j1[0].line,j2[0].line)
+coccilib.report.print_report(j0[0], msg)
+

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

* [PATCH] coccinelle: api: check for propagation of error from platform_get_irq
@ 2015-12-26 19:24 ` Julia Lawall
  0 siblings, 0 replies; 51+ messages in thread
From: Julia Lawall @ 2015-12-26 19:24 UTC (permalink / raw)
  To: cocci

The error return value of platform_get_irq seems to often get dropped.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---
 scripts/coccinelle/api/platform_get_irq_return.cocci |   53 ++++++++++
 1 file changed, 53 insertions(+)

diff --git a/scripts/coccinelle/api/platform_get_irq_return.cocci b/scripts/coccinelle/api/platform_get_irq_return.cocci
new file mode 100644
index 0000000..96fc560
--- /dev/null
+++ b/scripts/coccinelle/api/platform_get_irq_return.cocci
@@ -0,0 +1,53 @@
+/// Propagate the return value of platform_get_irq.
+//# Sometimes the return value of platform_get_irq is tested using <= 0, but 0
+//# might not be an appropriate return value in an error case.
+///
+// Confidence: Moderate
+// Copyright: (C) 2015 Julia Lawall, Inria. GPLv2.
+// URL: http://coccinelle.lip6.fr/
+// Options: --no-includes --include-headers
+
+virtual context
+virtual org
+virtual report
+
+// ----------------------------------------------------------------------------
+
+@r depends on context || org || report@
+constant C;
+expression e, ret;
+position j0, j1, j2;
+@@
+
+* e@j0 = platform_get_irq(...);
+if (...) {
+  ...
+  ret@j1 = -C;
+  ...
+  return ret@j2;
+}
+
+// ----------------------------------------------------------------------------
+
+@script:python r_org depends on org@
+j0 << r.j0;
+j1 << r.j1;
+j2 << r.j2;
+@@
+
+msg = "Propagate return value of platform_get_irq."
+coccilib.org.print_todo(j0[0], msg)
+coccilib.org.print_link(j1[0], "")
+coccilib.org.print_link(j2[0], "")
+
+// ----------------------------------------------------------------------------
+
+@script:python r_report depends on report@
+j0 << r.j0;
+j1 << r.j1;
+j2 << r.j2;
+@@
+
+msg = "Propagate return value of platform_get_irq around lines %s,%s." % (j1[0].line,j2[0].line)
+coccilib.report.print_report(j0[0], msg)
+


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

* [PATCH] coccinelle: api: check for propagation of error from platform_get_irq
@ 2015-12-26 19:24 ` Julia Lawall
  0 siblings, 0 replies; 51+ messages in thread
From: Julia Lawall @ 2015-12-26 19:24 UTC (permalink / raw)
  To: Gilles Muller, Nicolas Palix, Michal Marek, cocci, linux-kernel,
	Sergei Shtylyov
  Cc: kernel-janitors

The error return value of platform_get_irq seems to often get dropped.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---
 scripts/coccinelle/api/platform_get_irq_return.cocci |   53 ++++++++++
 1 file changed, 53 insertions(+)

diff --git a/scripts/coccinelle/api/platform_get_irq_return.cocci b/scripts/coccinelle/api/platform_get_irq_return.cocci
new file mode 100644
index 0000000..96fc560
--- /dev/null
+++ b/scripts/coccinelle/api/platform_get_irq_return.cocci
@@ -0,0 +1,53 @@
+/// Propagate the return value of platform_get_irq.
+//# Sometimes the return value of platform_get_irq is tested using <= 0, but 0
+//# might not be an appropriate return value in an error case.
+///
+// Confidence: Moderate
+// Copyright: (C) 2015 Julia Lawall, Inria. GPLv2.
+// URL: http://coccinelle.lip6.fr/
+// Options: --no-includes --include-headers
+
+virtual context
+virtual org
+virtual report
+
+// ----------------------------------------------------------------------------
+
+@r depends on context || org || report@
+constant C;
+expression e, ret;
+position j0, j1, j2;
+@@
+
+* e@j0 = platform_get_irq(...);
+if (...) {
+  ...
+  ret@j1 = -C;
+  ...
+  return ret@j2;
+}
+
+// ----------------------------------------------------------------------------
+
+@script:python r_org depends on org@
+j0 << r.j0;
+j1 << r.j1;
+j2 << r.j2;
+@@
+
+msg = "Propagate return value of platform_get_irq."
+coccilib.org.print_todo(j0[0], msg)
+coccilib.org.print_link(j1[0], "")
+coccilib.org.print_link(j2[0], "")
+
+// ----------------------------------------------------------------------------
+
+@script:python r_report depends on report@
+j0 << r.j0;
+j1 << r.j1;
+j2 << r.j2;
+@@
+
+msg = "Propagate return value of platform_get_irq around lines %s,%s." % (j1[0].line,j2[0].line)
+coccilib.report.print_report(j0[0], msg)
+


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

* [Cocci] [PATCH] coccinelle: api: check for propagation of error from platform_get_irq
  2015-12-26 19:24 ` Julia Lawall
  (?)
@ 2015-12-26 19:59   ` Sergei Shtylyov
  -1 siblings, 0 replies; 51+ messages in thread
From: Sergei Shtylyov @ 2015-12-26 19:59 UTC (permalink / raw)
  To: cocci

On 12/26/2015 10:24 PM, Julia Lawall wrote:

> The error return value of platform_get_irq seems to often get dropped.

    Maybe it was intentional (see my recent follow-up to your netdev patch). 
But if an error gets unconditionally overriden, deferred probing can't work. 
So your patches seem good things in the end. Thank you!

> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

[...]

MBR, Sergei

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

* Re: [PATCH] coccinelle: api: check for propagation of error from platform_get_irq
@ 2015-12-26 19:59   ` Sergei Shtylyov
  0 siblings, 0 replies; 51+ messages in thread
From: Sergei Shtylyov @ 2015-12-26 19:59 UTC (permalink / raw)
  To: cocci

On 12/26/2015 10:24 PM, Julia Lawall wrote:

> The error return value of platform_get_irq seems to often get dropped.

    Maybe it was intentional (see my recent follow-up to your netdev patch). 
But if an error gets unconditionally overriden, deferred probing can't work. 
So your patches seem good things in the end. Thank you!

> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

[...]

MBR, Sergei


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

* Re: [PATCH] coccinelle: api: check for propagation of error from platform_get_irq
@ 2015-12-26 19:59   ` Sergei Shtylyov
  0 siblings, 0 replies; 51+ messages in thread
From: Sergei Shtylyov @ 2015-12-26 19:59 UTC (permalink / raw)
  To: Julia Lawall, Gilles Muller, Nicolas Palix, Michal Marek, cocci,
	linux-kernel
  Cc: kernel-janitors

On 12/26/2015 10:24 PM, Julia Lawall wrote:

> The error return value of platform_get_irq seems to often get dropped.

    Maybe it was intentional (see my recent follow-up to your netdev patch). 
But if an error gets unconditionally overriden, deferred probing can't work. 
So your patches seem good things in the end. Thank you!

> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

[...]

MBR, Sergei


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

* [Cocci] [PATCH] coccinelle: api: check for propagation of error from platform_get_irq
  2015-12-26 19:59   ` Sergei Shtylyov
  (?)
@ 2015-12-26 20:08     ` Julia Lawall
  -1 siblings, 0 replies; 51+ messages in thread
From: Julia Lawall @ 2015-12-26 20:08 UTC (permalink / raw)
  To: cocci

On Sat, 26 Dec 2015, Sergei Shtylyov wrote:

> On 12/26/2015 10:24 PM, Julia Lawall wrote:
> 
> > The error return value of platform_get_irq seems to often get dropped.
> 
>    Maybe it was intentional (see my recent follow-up to your netdev patch).
> But if an error gets unconditionally overriden, deferred probing can't work.
> So your patches seem good things in the end. Thank you!

Actually, this semantic patch overloos the case where a constant is 
returned directly, which is apparently also popular.  I can update this if 
the whole concept is useful, but that's not clear at the moment...

julia

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

* Re: [PATCH] coccinelle: api: check for propagation of error from platform_get_irq
@ 2015-12-26 20:08     ` Julia Lawall
  0 siblings, 0 replies; 51+ messages in thread
From: Julia Lawall @ 2015-12-26 20:08 UTC (permalink / raw)
  To: cocci

On Sat, 26 Dec 2015, Sergei Shtylyov wrote:

> On 12/26/2015 10:24 PM, Julia Lawall wrote:
> 
> > The error return value of platform_get_irq seems to often get dropped.
> 
>    Maybe it was intentional (see my recent follow-up to your netdev patch).
> But if an error gets unconditionally overriden, deferred probing can't work.
> So your patches seem good things in the end. Thank you!

Actually, this semantic patch overloos the case where a constant is 
returned directly, which is apparently also popular.  I can update this if 
the whole concept is useful, but that's not clear at the moment...

julia

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

* Re: [PATCH] coccinelle: api: check for propagation of error from platform_get_irq
@ 2015-12-26 20:08     ` Julia Lawall
  0 siblings, 0 replies; 51+ messages in thread
From: Julia Lawall @ 2015-12-26 20:08 UTC (permalink / raw)
  To: Sergei Shtylyov
  Cc: Julia Lawall, Gilles Muller, Nicolas Palix, Michal Marek, cocci,
	linux-kernel, kernel-janitors

On Sat, 26 Dec 2015, Sergei Shtylyov wrote:

> On 12/26/2015 10:24 PM, Julia Lawall wrote:
> 
> > The error return value of platform_get_irq seems to often get dropped.
> 
>    Maybe it was intentional (see my recent follow-up to your netdev patch).
> But if an error gets unconditionally overriden, deferred probing can't work.
> So your patches seem good things in the end. Thank you!

Actually, this semantic patch overloos the case where a constant is 
returned directly, which is apparently also popular.  I can update this if 
the whole concept is useful, but that's not clear at the moment...

julia

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

* [Cocci] [PATCH] coccinelle: api: check for propagation of error from platform_get_irq
  2015-12-26 20:08     ` Julia Lawall
  (?)
@ 2015-12-26 20:24       ` Julia Lawall
  -1 siblings, 0 replies; 51+ messages in thread
From: Julia Lawall @ 2015-12-26 20:24 UTC (permalink / raw)
  To: cocci

The conclusion seems to be that it is useful to override the value, so we 
can just drop this semantic patch.

julia

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

* Re: [PATCH] coccinelle: api: check for propagation of error from platform_get_irq
@ 2015-12-26 20:24       ` Julia Lawall
  0 siblings, 0 replies; 51+ messages in thread
From: Julia Lawall @ 2015-12-26 20:24 UTC (permalink / raw)
  To: cocci

The conclusion seems to be that it is useful to override the value, so we 
can just drop this semantic patch.

julia

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

* Re: [PATCH] coccinelle: api: check for propagation of error from platform_get_irq
@ 2015-12-26 20:24       ` Julia Lawall
  0 siblings, 0 replies; 51+ messages in thread
From: Julia Lawall @ 2015-12-26 20:24 UTC (permalink / raw)
  To: Sergei Shtylyov
  Cc: Gilles Muller, Nicolas Palix, Michal Marek, cocci, linux-kernel,
	kernel-janitors

The conclusion seems to be that it is useful to override the value, so we 
can just drop this semantic patch.

julia

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

* [Cocci] [PATCH] coccinelle: api: check for propagation of error from platform_get_irq
  2015-12-26 20:24       ` Julia Lawall
  (?)
@ 2015-12-26 20:29         ` Sergei Shtylyov
  -1 siblings, 0 replies; 51+ messages in thread
From: Sergei Shtylyov @ 2015-12-26 20:29 UTC (permalink / raw)
  To: cocci

On 12/26/2015 11:24 PM, Julia Lawall wrote:

> The conclusion seems to be that it is useful to override the value, so we
> can just drop this semantic patch.

    No! As I said, unconditionally overriding an error value breaks the 
deferred probing. It's actually a bug to override it, so the patch seems 
*very* useful.

> julia

MBR, Sergei

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

* Re: [PATCH] coccinelle: api: check for propagation of error from platform_get_irq
@ 2015-12-26 20:29         ` Sergei Shtylyov
  0 siblings, 0 replies; 51+ messages in thread
From: Sergei Shtylyov @ 2015-12-26 20:29 UTC (permalink / raw)
  To: cocci

On 12/26/2015 11:24 PM, Julia Lawall wrote:

> The conclusion seems to be that it is useful to override the value, so we
> can just drop this semantic patch.

    No! As I said, unconditionally overriding an error value breaks the 
deferred probing. It's actually a bug to override it, so the patch seems 
*very* useful.

> julia

MBR, Sergei


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

* Re: [PATCH] coccinelle: api: check for propagation of error from platform_get_irq
@ 2015-12-26 20:29         ` Sergei Shtylyov
  0 siblings, 0 replies; 51+ messages in thread
From: Sergei Shtylyov @ 2015-12-26 20:29 UTC (permalink / raw)
  To: Julia Lawall
  Cc: Gilles Muller, Nicolas Palix, Michal Marek, cocci, linux-kernel,
	kernel-janitors

On 12/26/2015 11:24 PM, Julia Lawall wrote:

> The conclusion seems to be that it is useful to override the value, so we
> can just drop this semantic patch.

    No! As I said, unconditionally overriding an error value breaks the 
deferred probing. It's actually a bug to override it, so the patch seems 
*very* useful.

> julia

MBR, Sergei


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

* [Cocci] [PATCH] coccinelle: api: check for propagation of error from platform_get_irq
  2015-12-26 20:29         ` Sergei Shtylyov
  (?)
@ 2015-12-26 20:38           ` Julia Lawall
  -1 siblings, 0 replies; 51+ messages in thread
From: Julia Lawall @ 2015-12-26 20:38 UTC (permalink / raw)
  To: cocci



On Sat, 26 Dec 2015, Sergei Shtylyov wrote:

> On 12/26/2015 11:24 PM, Julia Lawall wrote:
> 
> > The conclusion seems to be that it is useful to override the value, so we
> > can just drop this semantic patch.
> 
>    No! As I said, unconditionally overriding an error value breaks the
> deferred probing. It's actually a bug to override it, so the patch seems
> *very* useful.

Ah, OK, I'll send an improved version then :)

julia

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

* Re: [PATCH] coccinelle: api: check for propagation of error from platform_get_irq
@ 2015-12-26 20:38           ` Julia Lawall
  0 siblings, 0 replies; 51+ messages in thread
From: Julia Lawall @ 2015-12-26 20:38 UTC (permalink / raw)
  To: cocci



On Sat, 26 Dec 2015, Sergei Shtylyov wrote:

> On 12/26/2015 11:24 PM, Julia Lawall wrote:
> 
> > The conclusion seems to be that it is useful to override the value, so we
> > can just drop this semantic patch.
> 
>    No! As I said, unconditionally overriding an error value breaks the
> deferred probing. It's actually a bug to override it, so the patch seems
> *very* useful.

Ah, OK, I'll send an improved version then :)

julia

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

* Re: [PATCH] coccinelle: api: check for propagation of error from platform_get_irq
@ 2015-12-26 20:38           ` Julia Lawall
  0 siblings, 0 replies; 51+ messages in thread
From: Julia Lawall @ 2015-12-26 20:38 UTC (permalink / raw)
  To: Sergei Shtylyov
  Cc: Gilles Muller, Nicolas Palix, Michal Marek, cocci, linux-kernel,
	kernel-janitors



On Sat, 26 Dec 2015, Sergei Shtylyov wrote:

> On 12/26/2015 11:24 PM, Julia Lawall wrote:
> 
> > The conclusion seems to be that it is useful to override the value, so we
> > can just drop this semantic patch.
> 
>    No! As I said, unconditionally overriding an error value breaks the
> deferred probing. It's actually a bug to override it, so the patch seems
> *very* useful.

Ah, OK, I'll send an improved version then :)

julia

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

* [Cocci] [PATCH v2] coccinelle: api: check for propagation of error from platform_get_irq
  2015-12-26 20:29         ` Sergei Shtylyov
  (?)
@ 2015-12-26 20:58           ` Julia Lawall
  -1 siblings, 0 replies; 51+ messages in thread
From: Julia Lawall @ 2015-12-26 20:58 UTC (permalink / raw)
  To: cocci

The error return value of platform_get_irq seems to often get dropped.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---

v2: Check for the direct return case also.  Added some mailing lists of
common offenders.

diff --git a/scripts/coccinelle/api/platform_get_irq_return.cocci b/scripts/coccinelle/api/platform_get_irq_return.cocci
new file mode 100644
index 0000000..44680d0
--- /dev/null
+++ b/scripts/coccinelle/api/platform_get_irq_return.cocci
@@ -0,0 +1,58 @@
+/// Propagate the return value of platform_get_irq.
+//# Sometimes the return value of platform_get_irq is tested using <= 0, but 0
+//# might not be an appropriate return value in an error case.
+///
+// Confidence: Moderate
+// Copyright: (C) 2015 Julia Lawall, Inria. GPLv2.
+// URL: http://coccinelle.lip6.fr/
+// Options: --no-includes --include-headers
+
+virtual context
+virtual org
+virtual report
+
+// ----------------------------------------------------------------------------
+
+ at r depends on context || org || report@
+constant C;
+statement S;
+expression e, ret;
+position j0, j1;
+@@
+
+* e at j0 = platform_get_irq(...);
+(
+if at j1 (...) {
+  ...
+  return -C;
+} else S
+|
+if at j1 (...) {
+  ...
+  ret = -C;
+  ...
+  return ret;
+} else S
+)
+
+// ----------------------------------------------------------------------------
+
+ at script:python r_org depends on org@
+j0 << r.j0;
+j1 << r.j1;
+@@
+
+msg = "Propagate return value of platform_get_irq."
+coccilib.org.print_todo(j0[0], msg)
+coccilib.org.print_link(j1[0], "")
+
+// ----------------------------------------------------------------------------
+
+@script:python r_report depends on report@
+j0 << r.j0;
+j1 << r.j1;
+@@
+
+msg = "Propagate return value of platform_get_irq around line %s." % (j1[0].line)
+coccilib.report.print_report(j0[0], msg)
+

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

* [PATCH v2] coccinelle: api: check for propagation of error from platform_get_irq
@ 2015-12-26 20:58           ` Julia Lawall
  0 siblings, 0 replies; 51+ messages in thread
From: Julia Lawall @ 2015-12-26 20:58 UTC (permalink / raw)
  To: cocci

The error return value of platform_get_irq seems to often get dropped.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---

v2: Check for the direct return case also.  Added some mailing lists of
common offenders.

diff --git a/scripts/coccinelle/api/platform_get_irq_return.cocci b/scripts/coccinelle/api/platform_get_irq_return.cocci
new file mode 100644
index 0000000..44680d0
--- /dev/null
+++ b/scripts/coccinelle/api/platform_get_irq_return.cocci
@@ -0,0 +1,58 @@
+/// Propagate the return value of platform_get_irq.
+//# Sometimes the return value of platform_get_irq is tested using <= 0, but 0
+//# might not be an appropriate return value in an error case.
+///
+// Confidence: Moderate
+// Copyright: (C) 2015 Julia Lawall, Inria. GPLv2.
+// URL: http://coccinelle.lip6.fr/
+// Options: --no-includes --include-headers
+
+virtual context
+virtual org
+virtual report
+
+// ----------------------------------------------------------------------------
+
+@r depends on context || org || report@
+constant C;
+statement S;
+expression e, ret;
+position j0, j1;
+@@
+
+* e@j0 = platform_get_irq(...);
+(
+if@j1 (...) {
+  ...
+  return -C;
+} else S
+|
+if@j1 (...) {
+  ...
+  ret = -C;
+  ...
+  return ret;
+} else S
+)
+
+// ----------------------------------------------------------------------------
+
+@script:python r_org depends on org@
+j0 << r.j0;
+j1 << r.j1;
+@@
+
+msg = "Propagate return value of platform_get_irq."
+coccilib.org.print_todo(j0[0], msg)
+coccilib.org.print_link(j1[0], "")
+
+// ----------------------------------------------------------------------------
+
+@script:python r_report depends on report@
+j0 << r.j0;
+j1 << r.j1;
+@@
+
+msg = "Propagate return value of platform_get_irq around line %s." % (j1[0].line)
+coccilib.report.print_report(j0[0], msg)
+

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

* [PATCH v2] coccinelle: api: check for propagation of error from platform_get_irq
@ 2015-12-26 20:58           ` Julia Lawall
  0 siblings, 0 replies; 51+ messages in thread
From: Julia Lawall @ 2015-12-26 20:58 UTC (permalink / raw)
  To: Gilles Muller, Nicolas Palix, Michal Marek, cocci, linux-kernel,
	Sergei Shtylyov, linux-media, netdev, linux-i2c, linux-spi,
	dri-devel
  Cc: kernel-janitors

The error return value of platform_get_irq seems to often get dropped.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---

v2: Check for the direct return case also.  Added some mailing lists of
common offenders.

diff --git a/scripts/coccinelle/api/platform_get_irq_return.cocci b/scripts/coccinelle/api/platform_get_irq_return.cocci
new file mode 100644
index 0000000..44680d0
--- /dev/null
+++ b/scripts/coccinelle/api/platform_get_irq_return.cocci
@@ -0,0 +1,58 @@
+/// Propagate the return value of platform_get_irq.
+//# Sometimes the return value of platform_get_irq is tested using <= 0, but 0
+//# might not be an appropriate return value in an error case.
+///
+// Confidence: Moderate
+// Copyright: (C) 2015 Julia Lawall, Inria. GPLv2.
+// URL: http://coccinelle.lip6.fr/
+// Options: --no-includes --include-headers
+
+virtual context
+virtual org
+virtual report
+
+// ----------------------------------------------------------------------------
+
+@r depends on context || org || report@
+constant C;
+statement S;
+expression e, ret;
+position j0, j1;
+@@
+
+* e@j0 = platform_get_irq(...);
+(
+if@j1 (...) {
+  ...
+  return -C;
+} else S
+|
+if@j1 (...) {
+  ...
+  ret = -C;
+  ...
+  return ret;
+} else S
+)
+
+// ----------------------------------------------------------------------------
+
+@script:python r_org depends on org@
+j0 << r.j0;
+j1 << r.j1;
+@@
+
+msg = "Propagate return value of platform_get_irq."
+coccilib.org.print_todo(j0[0], msg)
+coccilib.org.print_link(j1[0], "")
+
+// ----------------------------------------------------------------------------
+
+@script:python r_report depends on report@
+j0 << r.j0;
+j1 << r.j1;
+@@
+
+msg = "Propagate return value of platform_get_irq around line %s." % (j1[0].line)
+coccilib.report.print_report(j0[0], msg)
+

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

* [Cocci] [PATCH v2] coccinelle: api: check for propagation of error from platform_get_irq
  2015-12-26 20:58           ` Julia Lawall
  (?)
  (?)
@ 2015-12-26 22:26             ` Sergei Shtylyov
  -1 siblings, 0 replies; 51+ messages in thread
From: Sergei Shtylyov @ 2015-12-26 22:26 UTC (permalink / raw)
  To: cocci

On 12/26/2015 11:58 PM, Julia Lawall wrote:

> The error return value of platform_get_irq seems to often get dropped.
>
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
>
> ---
>
> v2: Check for the direct return case also.  Added some mailing lists of
> common offenders.
>
> diff --git a/scripts/coccinelle/api/platform_get_irq_return.cocci b/scripts/coccinelle/api/platform_get_irq_return.cocci
> new file mode 100644
> index 0000000..44680d0
> --- /dev/null
> +++ b/scripts/coccinelle/api/platform_get_irq_return.cocci
> @@ -0,0 +1,58 @@
> +/// Propagate the return value of platform_get_irq.
> +//# Sometimes the return value of platform_get_irq is tested using <= 0, but 0
> +//# might not be an appropriate return value in an error case.
> +///
> +// Confidence: Moderate
> +// Copyright: (C) 2015 Julia Lawall, Inria. GPLv2.
> +// URL: http://coccinelle.lip6.fr/
> +// Options: --no-includes --include-headers
> +
> +virtual context
> +virtual org
> +virtual report
> +
> +// ----------------------------------------------------------------------------
> +
> + at r depends on context || org || report@
> +constant C;
> +statement S;
> +expression e, ret;
> +position j0, j1;
> +@@
> +
> +* e at j0 = platform_get_irq(...);
> +(
> +if at j1 (...) {
> +  ...
> +  return -C;
> +} else S
> +|
> +if at j1 (...) {
> +  ...
> +  ret = -C;
> +  ...
> +  return ret;
> +} else S

    Well, this seems to also cover the (e <= 0) checks which do make same 
sense in the light of Linus considering IRQ0 invalid. So I'd be more specific 
about the checks here -- 0 should indeed be overridden with something if it's 
considered invalid.

MBR, Sergei

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

* Re: [PATCH v2] coccinelle: api: check for propagation of error from platform_get_irq
@ 2015-12-26 22:26             ` Sergei Shtylyov
  0 siblings, 0 replies; 51+ messages in thread
From: Sergei Shtylyov @ 2015-12-26 22:26 UTC (permalink / raw)
  To: cocci

On 12/26/2015 11:58 PM, Julia Lawall wrote:

> The error return value of platform_get_irq seems to often get dropped.
>
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
>
> ---
>
> v2: Check for the direct return case also.  Added some mailing lists of
> common offenders.
>
> diff --git a/scripts/coccinelle/api/platform_get_irq_return.cocci b/scripts/coccinelle/api/platform_get_irq_return.cocci
> new file mode 100644
> index 0000000..44680d0
> --- /dev/null
> +++ b/scripts/coccinelle/api/platform_get_irq_return.cocci
> @@ -0,0 +1,58 @@
> +/// Propagate the return value of platform_get_irq.
> +//# Sometimes the return value of platform_get_irq is tested using <= 0, but 0
> +//# might not be an appropriate return value in an error case.
> +///
> +// Confidence: Moderate
> +// Copyright: (C) 2015 Julia Lawall, Inria. GPLv2.
> +// URL: http://coccinelle.lip6.fr/
> +// Options: --no-includes --include-headers
> +
> +virtual context
> +virtual org
> +virtual report
> +
> +// ----------------------------------------------------------------------------
> +
> +@r depends on context || org || report@
> +constant C;
> +statement S;
> +expression e, ret;
> +position j0, j1;
> +@@
> +
> +* e@j0 = platform_get_irq(...);
> +(
> +if@j1 (...) {
> +  ...
> +  return -C;
> +} else S
> +|
> +if@j1 (...) {
> +  ...
> +  ret = -C;
> +  ...
> +  return ret;
> +} else S

    Well, this seems to also cover the (e <= 0) checks which do make same 
sense in the light of Linus considering IRQ0 invalid. So I'd be more specific 
about the checks here -- 0 should indeed be overridden with something if it's 
considered invalid.

MBR, Sergei


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

* Re: [PATCH v2] coccinelle: api: check for propagation of error from platform_get_irq
@ 2015-12-26 22:26             ` Sergei Shtylyov
  0 siblings, 0 replies; 51+ messages in thread
From: Sergei Shtylyov @ 2015-12-26 22:26 UTC (permalink / raw)
  To: Julia Lawall, Gilles Muller, Nicolas Palix, Michal Marek,
	cocci-/FJkirnvOdkvYVN+rsErww, linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-media-u79uwXL29TY76Z2rM5mHXA, netdev-u79uwXL29TY76Z2rM5mHXA,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA,
	linux-spi-u79uwXL29TY76Z2rM5mHXA,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
  Cc: kernel-janitors-u79uwXL29TY76Z2rM5mHXA

On 12/26/2015 11:58 PM, Julia Lawall wrote:

> The error return value of platform_get_irq seems to often get dropped.
>
> Signed-off-by: Julia Lawall <Julia.Lawall-L2FTfq7BK8M@public.gmane.org>
>
> ---
>
> v2: Check for the direct return case also.  Added some mailing lists of
> common offenders.
>
> diff --git a/scripts/coccinelle/api/platform_get_irq_return.cocci b/scripts/coccinelle/api/platform_get_irq_return.cocci
> new file mode 100644
> index 0000000..44680d0
> --- /dev/null
> +++ b/scripts/coccinelle/api/platform_get_irq_return.cocci
> @@ -0,0 +1,58 @@
> +/// Propagate the return value of platform_get_irq.
> +//# Sometimes the return value of platform_get_irq is tested using <= 0, but 0
> +//# might not be an appropriate return value in an error case.
> +///
> +// Confidence: Moderate
> +// Copyright: (C) 2015 Julia Lawall, Inria. GPLv2.
> +// URL: http://coccinelle.lip6.fr/
> +// Options: --no-includes --include-headers
> +
> +virtual context
> +virtual org
> +virtual report
> +
> +// ----------------------------------------------------------------------------
> +
> +@r depends on context || org || report@
> +constant C;
> +statement S;
> +expression e, ret;
> +position j0, j1;
> +@@
> +
> +* e@j0 = platform_get_irq(...);
> +(
> +if@j1 (...) {
> +  ...
> +  return -C;
> +} else S
> +|
> +if@j1 (...) {
> +  ...
> +  ret = -C;
> +  ...
> +  return ret;
> +} else S

    Well, this seems to also cover the (e <= 0) checks which do make same 
sense in the light of Linus considering IRQ0 invalid. So I'd be more specific 
about the checks here -- 0 should indeed be overridden with something if it's 
considered invalid.

MBR, Sergei

--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH v2] coccinelle: api: check for propagation of error from platform_get_irq
@ 2015-12-26 22:26             ` Sergei Shtylyov
  0 siblings, 0 replies; 51+ messages in thread
From: Sergei Shtylyov @ 2015-12-26 22:26 UTC (permalink / raw)
  To: Julia Lawall, Gilles Muller, Nicolas Palix, Michal Marek, cocci,
	linux-kernel, linux-media, netdev, linux-i2c, linux-spi,
	dri-devel
  Cc: kernel-janitors

On 12/26/2015 11:58 PM, Julia Lawall wrote:

> The error return value of platform_get_irq seems to often get dropped.
>
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
>
> ---
>
> v2: Check for the direct return case also.  Added some mailing lists of
> common offenders.
>
> diff --git a/scripts/coccinelle/api/platform_get_irq_return.cocci b/scripts/coccinelle/api/platform_get_irq_return.cocci
> new file mode 100644
> index 0000000..44680d0
> --- /dev/null
> +++ b/scripts/coccinelle/api/platform_get_irq_return.cocci
> @@ -0,0 +1,58 @@
> +/// Propagate the return value of platform_get_irq.
> +//# Sometimes the return value of platform_get_irq is tested using <= 0, but 0
> +//# might not be an appropriate return value in an error case.
> +///
> +// Confidence: Moderate
> +// Copyright: (C) 2015 Julia Lawall, Inria. GPLv2.
> +// URL: http://coccinelle.lip6.fr/
> +// Options: --no-includes --include-headers
> +
> +virtual context
> +virtual org
> +virtual report
> +
> +// ----------------------------------------------------------------------------
> +
> +@r depends on context || org || report@
> +constant C;
> +statement S;
> +expression e, ret;
> +position j0, j1;
> +@@
> +
> +* e@j0 = platform_get_irq(...);
> +(
> +if@j1 (...) {
> +  ...
> +  return -C;
> +} else S
> +|
> +if@j1 (...) {
> +  ...
> +  ret = -C;
> +  ...
> +  return ret;
> +} else S

    Well, this seems to also cover the (e <= 0) checks which do make same 
sense in the light of Linus considering IRQ0 invalid. So I'd be more specific 
about the checks here -- 0 should indeed be overridden with something if it's 
considered invalid.

MBR, Sergei


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

* [Cocci] [PATCH v2] coccinelle: api: check for propagation of error from platform_get_irq
  2015-12-26 22:26             ` Sergei Shtylyov
  (?)
  (?)
@ 2015-12-26 22:32               ` Julia Lawall
  -1 siblings, 0 replies; 51+ messages in thread
From: Julia Lawall @ 2015-12-26 22:32 UTC (permalink / raw)
  To: cocci

On Sun, 27 Dec 2015, Sergei Shtylyov wrote:

> On 12/26/2015 11:58 PM, Julia Lawall wrote:
> 
> > The error return value of platform_get_irq seems to often get dropped.
> > 
> > Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
> > 
> > ---
> > 
> > v2: Check for the direct return case also.  Added some mailing lists of
> > common offenders.
> > 
> > diff --git a/scripts/coccinelle/api/platform_get_irq_return.cocci
> > b/scripts/coccinelle/api/platform_get_irq_return.cocci
> > new file mode 100644
> > index 0000000..44680d0
> > --- /dev/null
> > +++ b/scripts/coccinelle/api/platform_get_irq_return.cocci
> > @@ -0,0 +1,58 @@
> > +/// Propagate the return value of platform_get_irq.
> > +//# Sometimes the return value of platform_get_irq is tested using <= 0,
> > but 0
> > +//# might not be an appropriate return value in an error case.
> > +///
> > +// Confidence: Moderate
> > +// Copyright: (C) 2015 Julia Lawall, Inria. GPLv2.
> > +// URL: http://coccinelle.lip6.fr/
> > +// Options: --no-includes --include-headers
> > +
> > +virtual context
> > +virtual org
> > +virtual report
> > +
> > +//
> > ----------------------------------------------------------------------------
> > +
> > + at r depends on context || org || report@
> > +constant C;
> > +statement S;
> > +expression e, ret;
> > +position j0, j1;
> > +@@
> > +
> > +* e at j0 = platform_get_irq(...);
> > +(
> > +if at j1 (...) {
> > +  ...
> > +  return -C;
> > +} else S
> > +|
> > +if at j1 (...) {
> > +  ...
> > +  ret = -C;
> > +  ...
> > +  return ret;
> > +} else S
> 
>    Well, this seems to also cover the (e <= 0) checks which do make same sense
> in the light of Linus considering IRQ0 invalid. So I'd be more specific about
> the checks here -- 0 should indeed be overridden with something if it's
> considered invalid.

That's what the limitations section says (lines with #).  This doesn't 
make any changes, it only makes warnings, which should include the 
limitations information, so perhaps people can consider what it is that 
they really intend to do.

If you think this is not a good idea, then I can make the test more 
specific.

julia

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

* Re: [PATCH v2] coccinelle: api: check for propagation of error from platform_get_irq
@ 2015-12-26 22:32               ` Julia Lawall
  0 siblings, 0 replies; 51+ messages in thread
From: Julia Lawall @ 2015-12-26 22:32 UTC (permalink / raw)
  To: cocci

On Sun, 27 Dec 2015, Sergei Shtylyov wrote:

> On 12/26/2015 11:58 PM, Julia Lawall wrote:
> 
> > The error return value of platform_get_irq seems to often get dropped.
> > 
> > Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
> > 
> > ---
> > 
> > v2: Check for the direct return case also.  Added some mailing lists of
> > common offenders.
> > 
> > diff --git a/scripts/coccinelle/api/platform_get_irq_return.cocci
> > b/scripts/coccinelle/api/platform_get_irq_return.cocci
> > new file mode 100644
> > index 0000000..44680d0
> > --- /dev/null
> > +++ b/scripts/coccinelle/api/platform_get_irq_return.cocci
> > @@ -0,0 +1,58 @@
> > +/// Propagate the return value of platform_get_irq.
> > +//# Sometimes the return value of platform_get_irq is tested using <= 0,
> > but 0
> > +//# might not be an appropriate return value in an error case.
> > +///
> > +// Confidence: Moderate
> > +// Copyright: (C) 2015 Julia Lawall, Inria. GPLv2.
> > +// URL: http://coccinelle.lip6.fr/
> > +// Options: --no-includes --include-headers
> > +
> > +virtual context
> > +virtual org
> > +virtual report
> > +
> > +//
> > ----------------------------------------------------------------------------
> > +
> > +@r depends on context || org || report@
> > +constant C;
> > +statement S;
> > +expression e, ret;
> > +position j0, j1;
> > +@@
> > +
> > +* e@j0 = platform_get_irq(...);
> > +(
> > +if@j1 (...) {
> > +  ...
> > +  return -C;
> > +} else S
> > +|
> > +if@j1 (...) {
> > +  ...
> > +  ret = -C;
> > +  ...
> > +  return ret;
> > +} else S
> 
>    Well, this seems to also cover the (e <= 0) checks which do make same sense
> in the light of Linus considering IRQ0 invalid. So I'd be more specific about
> the checks here -- 0 should indeed be overridden with something if it's
> considered invalid.

That's what the limitations section says (lines with #).  This doesn't 
make any changes, it only makes warnings, which should include the 
limitations information, so perhaps people can consider what it is that 
they really intend to do.

If you think this is not a good idea, then I can make the test more 
specific.

julia

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

* Re: [PATCH v2] coccinelle: api: check for propagation of error from platform_get_irq
@ 2015-12-26 22:32               ` Julia Lawall
  0 siblings, 0 replies; 51+ messages in thread
From: Julia Lawall @ 2015-12-26 22:32 UTC (permalink / raw)
  To: Sergei Shtylyov
  Cc: Julia Lawall, Gilles Muller, Nicolas Palix, Michal Marek,
	cocci-/FJkirnvOdkvYVN+rsErww, linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-media-u79uwXL29TY76Z2rM5mHXA, netdev-u79uwXL29TY76Z2rM5mHXA,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA,
	linux-spi-u79uwXL29TY76Z2rM5mHXA,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	kernel-janitors-u79uwXL29TY76Z2rM5mHXA

On Sun, 27 Dec 2015, Sergei Shtylyov wrote:

> On 12/26/2015 11:58 PM, Julia Lawall wrote:
> 
> > The error return value of platform_get_irq seems to often get dropped.
> > 
> > Signed-off-by: Julia Lawall <Julia.Lawall-L2FTfq7BK8M@public.gmane.org>
> > 
> > ---
> > 
> > v2: Check for the direct return case also.  Added some mailing lists of
> > common offenders.
> > 
> > diff --git a/scripts/coccinelle/api/platform_get_irq_return.cocci
> > b/scripts/coccinelle/api/platform_get_irq_return.cocci
> > new file mode 100644
> > index 0000000..44680d0
> > --- /dev/null
> > +++ b/scripts/coccinelle/api/platform_get_irq_return.cocci
> > @@ -0,0 +1,58 @@
> > +/// Propagate the return value of platform_get_irq.
> > +//# Sometimes the return value of platform_get_irq is tested using <= 0,
> > but 0
> > +//# might not be an appropriate return value in an error case.
> > +///
> > +// Confidence: Moderate
> > +// Copyright: (C) 2015 Julia Lawall, Inria. GPLv2.
> > +// URL: http://coccinelle.lip6.fr/
> > +// Options: --no-includes --include-headers
> > +
> > +virtual context
> > +virtual org
> > +virtual report
> > +
> > +//
> > ----------------------------------------------------------------------------
> > +
> > +@r depends on context || org || report@
> > +constant C;
> > +statement S;
> > +expression e, ret;
> > +position j0, j1;
> > +@@
> > +
> > +* e@j0 = platform_get_irq(...);
> > +(
> > +if@j1 (...) {
> > +  ...
> > +  return -C;
> > +} else S
> > +|
> > +if@j1 (...) {
> > +  ...
> > +  ret = -C;
> > +  ...
> > +  return ret;
> > +} else S
> 
>    Well, this seems to also cover the (e <= 0) checks which do make same sense
> in the light of Linus considering IRQ0 invalid. So I'd be more specific about
> the checks here -- 0 should indeed be overridden with something if it's
> considered invalid.

That's what the limitations section says (lines with #).  This doesn't 
make any changes, it only makes warnings, which should include the 
limitations information, so perhaps people can consider what it is that 
they really intend to do.

If you think this is not a good idea, then I can make the test more 
specific.

julia
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH v2] coccinelle: api: check for propagation of error from platform_get_irq
@ 2015-12-26 22:32               ` Julia Lawall
  0 siblings, 0 replies; 51+ messages in thread
From: Julia Lawall @ 2015-12-26 22:32 UTC (permalink / raw)
  To: Sergei Shtylyov
  Cc: Julia Lawall, Gilles Muller, Nicolas Palix, Michal Marek, cocci,
	linux-kernel, linux-media, netdev, linux-i2c, linux-spi,
	dri-devel, kernel-janitors

On Sun, 27 Dec 2015, Sergei Shtylyov wrote:

> On 12/26/2015 11:58 PM, Julia Lawall wrote:
> 
> > The error return value of platform_get_irq seems to often get dropped.
> > 
> > Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
> > 
> > ---
> > 
> > v2: Check for the direct return case also.  Added some mailing lists of
> > common offenders.
> > 
> > diff --git a/scripts/coccinelle/api/platform_get_irq_return.cocci
> > b/scripts/coccinelle/api/platform_get_irq_return.cocci
> > new file mode 100644
> > index 0000000..44680d0
> > --- /dev/null
> > +++ b/scripts/coccinelle/api/platform_get_irq_return.cocci
> > @@ -0,0 +1,58 @@
> > +/// Propagate the return value of platform_get_irq.
> > +//# Sometimes the return value of platform_get_irq is tested using <= 0,
> > but 0
> > +//# might not be an appropriate return value in an error case.
> > +///
> > +// Confidence: Moderate
> > +// Copyright: (C) 2015 Julia Lawall, Inria. GPLv2.
> > +// URL: http://coccinelle.lip6.fr/
> > +// Options: --no-includes --include-headers
> > +
> > +virtual context
> > +virtual org
> > +virtual report
> > +
> > +//
> > ----------------------------------------------------------------------------
> > +
> > +@r depends on context || org || report@
> > +constant C;
> > +statement S;
> > +expression e, ret;
> > +position j0, j1;
> > +@@
> > +
> > +* e@j0 = platform_get_irq(...);
> > +(
> > +if@j1 (...) {
> > +  ...
> > +  return -C;
> > +} else S
> > +|
> > +if@j1 (...) {
> > +  ...
> > +  ret = -C;
> > +  ...
> > +  return ret;
> > +} else S
> 
>    Well, this seems to also cover the (e <= 0) checks which do make same sense
> in the light of Linus considering IRQ0 invalid. So I'd be more specific about
> the checks here -- 0 should indeed be overridden with something if it's
> considered invalid.

That's what the limitations section says (lines with #).  This doesn't 
make any changes, it only makes warnings, which should include the 
limitations information, so perhaps people can consider what it is that 
they really intend to do.

If you think this is not a good idea, then I can make the test more 
specific.

julia

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

* [Cocci] [PATCH v2] coccinelle: api: check for propagation of error from platform_get_irq
  2015-12-26 22:32               ` Julia Lawall
  (?)
@ 2015-12-26 22:36                 ` Sergei Shtylyov
  -1 siblings, 0 replies; 51+ messages in thread
From: Sergei Shtylyov @ 2015-12-26 22:36 UTC (permalink / raw)
  To: cocci

On 12/27/2015 01:32 AM, Julia Lawall wrote:

>>> The error return value of platform_get_irq seems to often get dropped.
>>>
>>> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
>>>
>>> ---
>>>
>>> v2: Check for the direct return case also.  Added some mailing lists of
>>> common offenders.
>>>
>>> diff --git a/scripts/coccinelle/api/platform_get_irq_return.cocci
>>> b/scripts/coccinelle/api/platform_get_irq_return.cocci
>>> new file mode 100644
>>> index 0000000..44680d0
>>> --- /dev/null
>>> +++ b/scripts/coccinelle/api/platform_get_irq_return.cocci
>>> @@ -0,0 +1,58 @@
>>> +/// Propagate the return value of platform_get_irq.
>>> +//# Sometimes the return value of platform_get_irq is tested using <= 0,
>>> but 0
>>> +//# might not be an appropriate return value in an error case.
>>> +///
>>> +// Confidence: Moderate
>>> +// Copyright: (C) 2015 Julia Lawall, Inria. GPLv2.
>>> +// URL: http://coccinelle.lip6.fr/
>>> +// Options: --no-includes --include-headers
>>> +
>>> +virtual context
>>> +virtual org
>>> +virtual report
>>> +
>>> +//
>>> ----------------------------------------------------------------------------
>>> +
>>> + at r depends on context || org || report@
>>> +constant C;
>>> +statement S;
>>> +expression e, ret;
>>> +position j0, j1;
>>> +@@
>>> +
>>> +* e at j0 = platform_get_irq(...);
>>> +(
>>> +if at j1 (...) {
>>> +  ...
>>> +  return -C;
>>> +} else S
>>> +|
>>> +if at j1 (...) {
>>> +  ...
>>> +  ret = -C;
>>> +  ...
>>> +  return ret;
>>> +} else S
>>
>>     Well, this seems to also cover the (e <= 0) checks which do make same sense
>> in the light of Linus considering IRQ0 invalid. So I'd be more specific about
>> the checks here -- 0 should indeed be overridden with something if it's
>> considered invalid.
>
> That's what the limitations section says (lines with #).  This doesn't

    Ah, failed to notice those, only saw after replying.

> make any changes, it only makes warnings, which should include the
> limitations information, so perhaps people can consider what it is that
> they really intend to do.
 >
> If you think this is not a good idea, then I can make the test more
> specific.

    Well, looking again, the patch should be good. I just thought its goal was 
to fix the code as well...

> julia

MBR, Sergei

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

* Re: [PATCH v2] coccinelle: api: check for propagation of error from platform_get_irq
@ 2015-12-26 22:36                 ` Sergei Shtylyov
  0 siblings, 0 replies; 51+ messages in thread
From: Sergei Shtylyov @ 2015-12-26 22:36 UTC (permalink / raw)
  To: cocci

On 12/27/2015 01:32 AM, Julia Lawall wrote:

>>> The error return value of platform_get_irq seems to often get dropped.
>>>
>>> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
>>>
>>> ---
>>>
>>> v2: Check for the direct return case also.  Added some mailing lists of
>>> common offenders.
>>>
>>> diff --git a/scripts/coccinelle/api/platform_get_irq_return.cocci
>>> b/scripts/coccinelle/api/platform_get_irq_return.cocci
>>> new file mode 100644
>>> index 0000000..44680d0
>>> --- /dev/null
>>> +++ b/scripts/coccinelle/api/platform_get_irq_return.cocci
>>> @@ -0,0 +1,58 @@
>>> +/// Propagate the return value of platform_get_irq.
>>> +//# Sometimes the return value of platform_get_irq is tested using <= 0,
>>> but 0
>>> +//# might not be an appropriate return value in an error case.
>>> +///
>>> +// Confidence: Moderate
>>> +// Copyright: (C) 2015 Julia Lawall, Inria. GPLv2.
>>> +// URL: http://coccinelle.lip6.fr/
>>> +// Options: --no-includes --include-headers
>>> +
>>> +virtual context
>>> +virtual org
>>> +virtual report
>>> +
>>> +//
>>> ----------------------------------------------------------------------------
>>> +
>>> +@r depends on context || org || report@
>>> +constant C;
>>> +statement S;
>>> +expression e, ret;
>>> +position j0, j1;
>>> +@@
>>> +
>>> +* e@j0 = platform_get_irq(...);
>>> +(
>>> +if@j1 (...) {
>>> +  ...
>>> +  return -C;
>>> +} else S
>>> +|
>>> +if@j1 (...) {
>>> +  ...
>>> +  ret = -C;
>>> +  ...
>>> +  return ret;
>>> +} else S
>>
>>     Well, this seems to also cover the (e <= 0) checks which do make same sense
>> in the light of Linus considering IRQ0 invalid. So I'd be more specific about
>> the checks here -- 0 should indeed be overridden with something if it's
>> considered invalid.
>
> That's what the limitations section says (lines with #).  This doesn't

    Ah, failed to notice those, only saw after replying.

> make any changes, it only makes warnings, which should include the
> limitations information, so perhaps people can consider what it is that
> they really intend to do.
 >
> If you think this is not a good idea, then I can make the test more
> specific.

    Well, looking again, the patch should be good. I just thought its goal was 
to fix the code as well...

> julia

MBR, Sergei


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

* Re: [PATCH v2] coccinelle: api: check for propagation of error from platform_get_irq
@ 2015-12-26 22:36                 ` Sergei Shtylyov
  0 siblings, 0 replies; 51+ messages in thread
From: Sergei Shtylyov @ 2015-12-26 22:36 UTC (permalink / raw)
  To: Julia Lawall
  Cc: Gilles Muller, Nicolas Palix, Michal Marek, cocci, linux-kernel,
	linux-media, netdev, linux-i2c, linux-spi, dri-devel,
	kernel-janitors

On 12/27/2015 01:32 AM, Julia Lawall wrote:

>>> The error return value of platform_get_irq seems to often get dropped.
>>>
>>> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
>>>
>>> ---
>>>
>>> v2: Check for the direct return case also.  Added some mailing lists of
>>> common offenders.
>>>
>>> diff --git a/scripts/coccinelle/api/platform_get_irq_return.cocci
>>> b/scripts/coccinelle/api/platform_get_irq_return.cocci
>>> new file mode 100644
>>> index 0000000..44680d0
>>> --- /dev/null
>>> +++ b/scripts/coccinelle/api/platform_get_irq_return.cocci
>>> @@ -0,0 +1,58 @@
>>> +/// Propagate the return value of platform_get_irq.
>>> +//# Sometimes the return value of platform_get_irq is tested using <= 0,
>>> but 0
>>> +//# might not be an appropriate return value in an error case.
>>> +///
>>> +// Confidence: Moderate
>>> +// Copyright: (C) 2015 Julia Lawall, Inria. GPLv2.
>>> +// URL: http://coccinelle.lip6.fr/
>>> +// Options: --no-includes --include-headers
>>> +
>>> +virtual context
>>> +virtual org
>>> +virtual report
>>> +
>>> +//
>>> ----------------------------------------------------------------------------
>>> +
>>> +@r depends on context || org || report@
>>> +constant C;
>>> +statement S;
>>> +expression e, ret;
>>> +position j0, j1;
>>> +@@
>>> +
>>> +* e@j0 = platform_get_irq(...);
>>> +(
>>> +if@j1 (...) {
>>> +  ...
>>> +  return -C;
>>> +} else S
>>> +|
>>> +if@j1 (...) {
>>> +  ...
>>> +  ret = -C;
>>> +  ...
>>> +  return ret;
>>> +} else S
>>
>>     Well, this seems to also cover the (e <= 0) checks which do make same sense
>> in the light of Linus considering IRQ0 invalid. So I'd be more specific about
>> the checks here -- 0 should indeed be overridden with something if it's
>> considered invalid.
>
> That's what the limitations section says (lines with #).  This doesn't

    Ah, failed to notice those, only saw after replying.

> make any changes, it only makes warnings, which should include the
> limitations information, so perhaps people can consider what it is that
> they really intend to do.
 >
> If you think this is not a good idea, then I can make the test more
> specific.

    Well, looking again, the patch should be good. I just thought its goal was 
to fix the code as well...

> julia

MBR, Sergei

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

* [Cocci] [PATCH v2] coccinelle: api: check for propagation of error from platform_get_irq
  2015-12-26 22:36                 ` Sergei Shtylyov
  (?)
  (?)
@ 2015-12-27  6:13                   ` Julia Lawall
  -1 siblings, 0 replies; 51+ messages in thread
From: Julia Lawall @ 2015-12-27  6:13 UTC (permalink / raw)
  To: cocci

>    Well, looking again, the patch should be good. I just thought its goal was
> to fix the code as well...

I could do that for the irq < 0 case, but I think that in that case, kbuild
will only run the patch version, and the <= cases will not be reported on.
I don't have a general fix for the <= 0.  Is it even correct to have < in
some cases and <= in others?

julia

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

* Re: [PATCH v2] coccinelle: api: check for propagation of error from platform_get_irq
@ 2015-12-27  6:13                   ` Julia Lawall
  0 siblings, 0 replies; 51+ messages in thread
From: Julia Lawall @ 2015-12-27  6:13 UTC (permalink / raw)
  To: cocci

>    Well, looking again, the patch should be good. I just thought its goal was
> to fix the code as well...

I could do that for the irq < 0 case, but I think that in that case, kbuild
will only run the patch version, and the <= cases will not be reported on.
I don't have a general fix for the <= 0.  Is it even correct to have < in
some cases and <= in others?

julia

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

* Re: [PATCH v2] coccinelle: api: check for propagation of error from platform_get_irq
@ 2015-12-27  6:13                   ` Julia Lawall
  0 siblings, 0 replies; 51+ messages in thread
From: Julia Lawall @ 2015-12-27  6:13 UTC (permalink / raw)
  To: Sergei Shtylyov
  Cc: kernel-janitors, Gilles Muller, netdev, Nicolas Palix,
	linux-kernel, dri-devel, linux-spi, Julia Lawall, Michal Marek,
	linux-i2c, cocci, linux-media

>    Well, looking again, the patch should be good. I just thought its goal was
> to fix the code as well...

I could do that for the irq < 0 case, but I think that in that case, kbuild
will only run the patch version, and the <= cases will not be reported on.
I don't have a general fix for the <= 0.  Is it even correct to have < in
some cases and <= in others?

julia
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v2] coccinelle: api: check for propagation of error from platform_get_irq
@ 2015-12-27  6:13                   ` Julia Lawall
  0 siblings, 0 replies; 51+ messages in thread
From: Julia Lawall @ 2015-12-27  6:13 UTC (permalink / raw)
  To: Sergei Shtylyov
  Cc: Julia Lawall, Gilles Muller, Nicolas Palix, Michal Marek, cocci,
	linux-kernel, linux-media, netdev, linux-i2c, linux-spi,
	dri-devel, kernel-janitors

>    Well, looking again, the patch should be good. I just thought its goal was
> to fix the code as well...

I could do that for the irq < 0 case, but I think that in that case, kbuild
will only run the patch version, and the <= cases will not be reported on.
I don't have a general fix for the <= 0.  Is it even correct to have < in
some cases and <= in others?

julia

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

* [Cocci] [PATCH v2] coccinelle: api: check for propagation of error from platform_get_irq
  2015-12-26 20:58           ` Julia Lawall
  (?)
  (?)
@ 2015-12-27  7:58             ` SF Markus Elfring
  -1 siblings, 0 replies; 51+ messages in thread
From: SF Markus Elfring @ 2015-12-27  7:58 UTC (permalink / raw)
  To: cocci

> The error return value of platform_get_irq seems to often get dropped.

How do you think about any more fine-tuning here?

Commit message:
* ? of the platform_get_irq() function seems to get dropped too often.

* Why do you concentrate on a single function name?
  Do you plan to extend this source code analysis approach?


> + at script:python r_report depends on report@
> +j0 << r.j0;
> +j1 << r.j1;
> +@@
> +
> +msg = "Propagate return value of platform_get_irq around line %s." % (j1[0].line)

Are there more unchecked return values which are interesting
for further considerations?
https://cwe.mitre.org/data/definitions/252.html

Regards,
Markus

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

* Re: [Cocci] [PATCH v2] coccinelle: api: check for propagation of error from platform_get_irq
@ 2015-12-27  7:58             ` SF Markus Elfring
  0 siblings, 0 replies; 51+ messages in thread
From: SF Markus Elfring @ 2015-12-27  7:58 UTC (permalink / raw)
  To: cocci

> The error return value of platform_get_irq seems to often get dropped.

How do you think about any more fine-tuning here?

Commit message:
* … of the platform_get_irq() function seems to get dropped too often.

* Why do you concentrate on a single function name?
  Do you plan to extend this source code analysis approach?


> +@script:python r_report depends on report@
> +j0 << r.j0;
> +j1 << r.j1;
> +@@
> +
> +msg = "Propagate return value of platform_get_irq around line %s." % (j1[0].line)

Are there more unchecked return values which are interesting
for further considerations?
https://cwe.mitre.org/data/definitions/252.html

Regards,
Markus
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [Cocci] [PATCH v2] coccinelle: api: check for propagation of error from platform_get_irq
@ 2015-12-27  7:58             ` SF Markus Elfring
  0 siblings, 0 replies; 51+ messages in thread
From: SF Markus Elfring @ 2015-12-27  7:58 UTC (permalink / raw)
  To: Julia Lawall
  Cc: Coccinelle, LKML, kernel-janitors, linux-media, netdev, linux-i2c,
	linux-spi, dri-devel, Gilles Muller, Michal Marek, Nicolas Palix,
	Sergei Shtylyov

> The error return value of platform_get_irq seems to often get dropped.

How do you think about any more fine-tuning here?

Commit message:
* … of the platform_get_irq() function seems to get dropped too often.

* Why do you concentrate on a single function name?
  Do you plan to extend this source code analysis approach?


> +@script:python r_report depends on report@
> +j0 << r.j0;
> +j1 << r.j1;
> +@@
> +
> +msg = "Propagate return value of platform_get_irq around line %s." % (j1[0].line)

Are there more unchecked return values which are interesting
for further considerations?
https://cwe.mitre.org/data/definitions/252.html

Regards,
Markus
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [Cocci] [PATCH v2] coccinelle: api: check for propagation of error from platform_get_irq
@ 2015-12-27  7:58             ` SF Markus Elfring
  0 siblings, 0 replies; 51+ messages in thread
From: SF Markus Elfring @ 2015-12-27  7:58 UTC (permalink / raw)
  To: Julia Lawall
  Cc: Coccinelle, LKML, kernel-janitors, linux-media, netdev, linux-i2c,
	linux-spi, dri-devel, Gilles Muller, Michal Marek, Nicolas Palix,
	Sergei Shtylyov

> The error return value of platform_get_irq seems to often get dropped.

How do you think about any more fine-tuning here?

Commit message:
* … of the platform_get_irq() function seems to get dropped too often.

* Why do you concentrate on a single function name?
  Do you plan to extend this source code analysis approach?


> +@script:python r_report depends on report@
> +j0 << r.j0;
> +j1 << r.j1;
> +@@
> +
> +msg = "Propagate return value of platform_get_irq around line %s." % (j1[0].line)

Are there more unchecked return values which are interesting
for further considerations?
https://cwe.mitre.org/data/definitions/252.html

Regards,
Markus

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

* [Cocci] [PATCH v2] coccinelle: api: check for propagation of error from platform_get_irq
  2015-12-27  6:13                   ` Julia Lawall
  (?)
@ 2015-12-27 11:18                     ` Sergei Shtylyov
  -1 siblings, 0 replies; 51+ messages in thread
From: Sergei Shtylyov @ 2015-12-27 11:18 UTC (permalink / raw)
  To: cocci

On 12/27/2015 9:13 AM, Julia Lawall wrote:

>>     Well, looking again, the patch should be good. I just thought its goal was
>> to fix the code as well...
>
> I could do that for the irq < 0 case, but I think that in that case, kbuild
> will only run the patch version, and the <= cases will not be reported on.
> I don't have a general fix for the <= 0.  Is it even correct to have < in
> some cases and <= in others?

    That's a good question...
    In my prior fixes of this case I preferred to consider IRQ0 valid and so 
used 'irq < 0'. I myself don't share the "IRQ0 is invalid" sentiment...

> julia

MBR, Sergei

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

* Re: [PATCH v2] coccinelle: api: check for propagation of error from platform_get_irq
@ 2015-12-27 11:18                     ` Sergei Shtylyov
  0 siblings, 0 replies; 51+ messages in thread
From: Sergei Shtylyov @ 2015-12-27 11:18 UTC (permalink / raw)
  To: cocci

On 12/27/2015 9:13 AM, Julia Lawall wrote:

>>     Well, looking again, the patch should be good. I just thought its goal was
>> to fix the code as well...
>
> I could do that for the irq < 0 case, but I think that in that case, kbuild
> will only run the patch version, and the <= cases will not be reported on.
> I don't have a general fix for the <= 0.  Is it even correct to have < in
> some cases and <= in others?

    That's a good question...
    In my prior fixes of this case I preferred to consider IRQ0 valid and so 
used 'irq < 0'. I myself don't share the "IRQ0 is invalid" sentiment...

> julia

MBR, Sergei


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

* Re: [PATCH v2] coccinelle: api: check for propagation of error from platform_get_irq
@ 2015-12-27 11:18                     ` Sergei Shtylyov
  0 siblings, 0 replies; 51+ messages in thread
From: Sergei Shtylyov @ 2015-12-27 11:18 UTC (permalink / raw)
  To: Julia Lawall
  Cc: Gilles Muller, Nicolas Palix, Michal Marek, cocci, linux-kernel,
	linux-media, netdev, linux-i2c, linux-spi, dri-devel,
	kernel-janitors

On 12/27/2015 9:13 AM, Julia Lawall wrote:

>>     Well, looking again, the patch should be good. I just thought its goal was
>> to fix the code as well...
>
> I could do that for the irq < 0 case, but I think that in that case, kbuild
> will only run the patch version, and the <= cases will not be reported on.
> I don't have a general fix for the <= 0.  Is it even correct to have < in
> some cases and <= in others?

    That's a good question...
    In my prior fixes of this case I preferred to consider IRQ0 valid and so 
used 'irq < 0'. I myself don't share the "IRQ0 is invalid" sentiment...

> julia

MBR, Sergei


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

* [Cocci] [PATCH v2] coccinelle: api: check for propagation of error from platform_get_irq
  2015-12-27  7:58             ` SF Markus Elfring
  (?)
  (?)
@ 2015-12-27 11:41               ` Julia Lawall
  -1 siblings, 0 replies; 51+ messages in thread
From: Julia Lawall @ 2015-12-27 11:41 UTC (permalink / raw)
  To: cocci



On Sun, 27 Dec 2015, SF Markus Elfring wrote:

> > The error return value of platform_get_irq seems to often get dropped.
> 
> How do you think about any more fine-tuning here?
> 
> Commit message:
> * ? of the platform_get_irq() function seems to get dropped too often.
> 
> * Why do you concentrate on a single function name?
>   Do you plan to extend this source code analysis approach?
> 
> 
> > + at script:python r_report depends on report@
> > +j0 << r.j0;
> > +j1 << r.j1;
> > +@@
> > +
> > +msg = "Propagate return value of platform_get_irq around line %s." % (j1[0].line)
> 
> Are there more unchecked return values which are interesting
> for further considerations?
> https://cwe.mitre.org/data/definitions/252.html

The value is not unchecked.  I made a specific rule because the specific 
problem is quite common.

julia

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

* Re: [Cocci] [PATCH v2] coccinelle: api: check for propagation of error from platform_get_irq
@ 2015-12-27 11:41               ` Julia Lawall
  0 siblings, 0 replies; 51+ messages in thread
From: Julia Lawall @ 2015-12-27 11:41 UTC (permalink / raw)
  To: cocci

[-- Attachment #1: Type: TEXT/PLAIN, Size: 862 bytes --]



On Sun, 27 Dec 2015, SF Markus Elfring wrote:

> > The error return value of platform_get_irq seems to often get dropped.
> 
> How do you think about any more fine-tuning here?
> 
> Commit message:
> * … of the platform_get_irq() function seems to get dropped too often.
> 
> * Why do you concentrate on a single function name?
>   Do you plan to extend this source code analysis approach?
> 
> 
> > +@script:python r_report depends on report@
> > +j0 << r.j0;
> > +j1 << r.j1;
> > +@@
> > +
> > +msg = "Propagate return value of platform_get_irq around line %s." % (j1[0].line)
> 
> Are there more unchecked return values which are interesting
> for further considerations?
> https://cwe.mitre.org/data/definitions/252.html

The value is not unchecked.  I made a specific rule because the specific 
problem is quite common.

julia

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

* Re: [Cocci] [PATCH v2] coccinelle: api: check for propagation of error from platform_get_irq
@ 2015-12-27 11:41               ` Julia Lawall
  0 siblings, 0 replies; 51+ messages in thread
From: Julia Lawall @ 2015-12-27 11:41 UTC (permalink / raw)
  To: SF Markus Elfring
  Cc: Sergei Shtylyov, Gilles Muller, netdev, Nicolas Palix,
	kernel-janitors, LKML, dri-devel, linux-spi, Julia Lawall,
	Michal Marek, linux-i2c, Coccinelle, linux-media

[-- Attachment #1: Type: TEXT/PLAIN, Size: 862 bytes --]



On Sun, 27 Dec 2015, SF Markus Elfring wrote:

> > The error return value of platform_get_irq seems to often get dropped.
> 
> How do you think about any more fine-tuning here?
> 
> Commit message:
> * … of the platform_get_irq() function seems to get dropped too often.
> 
> * Why do you concentrate on a single function name?
>   Do you plan to extend this source code analysis approach?
> 
> 
> > +@script:python r_report depends on report@
> > +j0 << r.j0;
> > +j1 << r.j1;
> > +@@
> > +
> > +msg = "Propagate return value of platform_get_irq around line %s." % (j1[0].line)
> 
> Are there more unchecked return values which are interesting
> for further considerations?
> https://cwe.mitre.org/data/definitions/252.html

The value is not unchecked.  I made a specific rule because the specific 
problem is quite common.

julia

[-- Attachment #2: Type: text/plain, Size: 159 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [Cocci] [PATCH v2] coccinelle: api: check for propagation of error from platform_get_irq
@ 2015-12-27 11:41               ` Julia Lawall
  0 siblings, 0 replies; 51+ messages in thread
From: Julia Lawall @ 2015-12-27 11:41 UTC (permalink / raw)
  To: SF Markus Elfring
  Cc: Julia Lawall, Coccinelle, LKML, kernel-janitors, linux-media,
	netdev, linux-i2c, linux-spi, dri-devel, Gilles Muller,
	Michal Marek, Nicolas Palix, Sergei Shtylyov

[-- Attachment #1: Type: TEXT/PLAIN, Size: 833 bytes --]



On Sun, 27 Dec 2015, SF Markus Elfring wrote:

> > The error return value of platform_get_irq seems to often get dropped.
> 
> How do you think about any more fine-tuning here?
> 
> Commit message:
> * … of the platform_get_irq() function seems to get dropped too often.
> 
> * Why do you concentrate on a single function name?
>   Do you plan to extend this source code analysis approach?
> 
> 
> > +@script:python r_report depends on report@
> > +j0 << r.j0;
> > +j1 << r.j1;
> > +@@
> > +
> > +msg = "Propagate return value of platform_get_irq around line %s." % (j1[0].line)
> 
> Are there more unchecked return values which are interesting
> for further considerations?
> https://cwe.mitre.org/data/definitions/252.html

The value is not unchecked.  I made a specific rule because the specific 
problem is quite common.

julia

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

* [Cocci] [PATCH v2] coccinelle: api: check for propagation of error from platform_get_irq
  2015-12-27 11:41               ` Julia Lawall
  (?)
  (?)
@ 2015-12-27 16:24                 ` SF Markus Elfring
  -1 siblings, 0 replies; 51+ messages in thread
From: SF Markus Elfring @ 2015-12-27 16:24 UTC (permalink / raw)
  To: cocci

>> https://cwe.mitre.org/data/definitions/252.html
> 
> The value is not unchecked.

Would you like to express any stronger relationship between
the function call example and the occurrence of an if statement
by the discussed SmPL script?


> I made a specific rule because the specific problem is quite common.

Can it become also interesting to generalise this search pattern?

Regards,
Markus

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

* Re: [Cocci] [PATCH v2] coccinelle: api: check for propagation of error from platform_get_irq
@ 2015-12-27 16:24                 ` SF Markus Elfring
  0 siblings, 0 replies; 51+ messages in thread
From: SF Markus Elfring @ 2015-12-27 16:24 UTC (permalink / raw)
  To: cocci

>> https://cwe.mitre.org/data/definitions/252.html
> 
> The value is not unchecked.

Would you like to express any stronger relationship between
the function call example and the occurrence of an if statement
by the discussed SmPL script?


> I made a specific rule because the specific problem is quite common.

Can it become also interesting to generalise this search pattern?

Regards,
Markus

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

* Re: [Cocci] [PATCH v2] coccinelle: api: check for propagation of error from platform_get_irq
@ 2015-12-27 16:24                 ` SF Markus Elfring
  0 siblings, 0 replies; 51+ messages in thread
From: SF Markus Elfring @ 2015-12-27 16:24 UTC (permalink / raw)
  To: Julia Lawall
  Cc: Sergei Shtylyov, Gilles Muller, netdev, Nicolas Palix,
	kernel-janitors, LKML, dri-devel, linux-spi, Michal Marek,
	linux-i2c, Coccinelle, linux-media

>> https://cwe.mitre.org/data/definitions/252.html
> 
> The value is not unchecked.

Would you like to express any stronger relationship between
the function call example and the occurrence of an if statement
by the discussed SmPL script?


> I made a specific rule because the specific problem is quite common.

Can it become also interesting to generalise this search pattern?

Regards,
Markus
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [Cocci] [PATCH v2] coccinelle: api: check for propagation of error from platform_get_irq
@ 2015-12-27 16:24                 ` SF Markus Elfring
  0 siblings, 0 replies; 51+ messages in thread
From: SF Markus Elfring @ 2015-12-27 16:24 UTC (permalink / raw)
  To: Julia Lawall
  Cc: Coccinelle, LKML, kernel-janitors, linux-media, netdev, linux-i2c,
	linux-spi, dri-devel, Gilles Muller, Michal Marek, Nicolas Palix,
	Sergei Shtylyov

>> https://cwe.mitre.org/data/definitions/252.html
> 
> The value is not unchecked.

Would you like to express any stronger relationship between
the function call example and the occurrence of an if statement
by the discussed SmPL script?


> I made a specific rule because the specific problem is quite common.

Can it become also interesting to generalise this search pattern?

Regards,
Markus

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

end of thread, other threads:[~2015-12-27 16:24 UTC | newest]

Thread overview: 51+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-26 19:24 [Cocci] [PATCH] coccinelle: api: check for propagation of error from platform_get_irq Julia Lawall
2015-12-26 19:24 ` Julia Lawall
2015-12-26 19:24 ` Julia Lawall
2015-12-26 19:59 ` [Cocci] " Sergei Shtylyov
2015-12-26 19:59   ` Sergei Shtylyov
2015-12-26 19:59   ` Sergei Shtylyov
2015-12-26 20:08   ` [Cocci] " Julia Lawall
2015-12-26 20:08     ` Julia Lawall
2015-12-26 20:08     ` Julia Lawall
2015-12-26 20:24     ` [Cocci] " Julia Lawall
2015-12-26 20:24       ` Julia Lawall
2015-12-26 20:24       ` Julia Lawall
2015-12-26 20:29       ` [Cocci] " Sergei Shtylyov
2015-12-26 20:29         ` Sergei Shtylyov
2015-12-26 20:29         ` Sergei Shtylyov
2015-12-26 20:38         ` [Cocci] " Julia Lawall
2015-12-26 20:38           ` Julia Lawall
2015-12-26 20:38           ` Julia Lawall
2015-12-26 20:58         ` [Cocci] [PATCH v2] " Julia Lawall
2015-12-26 20:58           ` Julia Lawall
2015-12-26 20:58           ` Julia Lawall
2015-12-26 22:26           ` [Cocci] " Sergei Shtylyov
2015-12-26 22:26             ` Sergei Shtylyov
2015-12-26 22:26             ` Sergei Shtylyov
2015-12-26 22:26             ` Sergei Shtylyov
2015-12-26 22:32             ` [Cocci] " Julia Lawall
2015-12-26 22:32               ` Julia Lawall
2015-12-26 22:32               ` Julia Lawall
2015-12-26 22:32               ` Julia Lawall
2015-12-26 22:36               ` [Cocci] " Sergei Shtylyov
2015-12-26 22:36                 ` Sergei Shtylyov
2015-12-26 22:36                 ` Sergei Shtylyov
2015-12-27  6:13                 ` [Cocci] " Julia Lawall
2015-12-27  6:13                   ` Julia Lawall
2015-12-27  6:13                   ` Julia Lawall
2015-12-27  6:13                   ` Julia Lawall
2015-12-27 11:18                   ` [Cocci] " Sergei Shtylyov
2015-12-27 11:18                     ` Sergei Shtylyov
2015-12-27 11:18                     ` Sergei Shtylyov
2015-12-27  7:58           ` [Cocci] " SF Markus Elfring
2015-12-27  7:58             ` SF Markus Elfring
2015-12-27  7:58             ` SF Markus Elfring
2015-12-27  7:58             ` SF Markus Elfring
2015-12-27 11:41             ` Julia Lawall
2015-12-27 11:41               ` Julia Lawall
2015-12-27 11:41               ` Julia Lawall
2015-12-27 11:41               ` Julia Lawall
2015-12-27 16:24               ` SF Markus Elfring
2015-12-27 16:24                 ` SF Markus Elfring
2015-12-27 16:24                 ` SF Markus Elfring
2015-12-27 16:24                 ` SF Markus Elfring

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.