mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/6] fix error return code
@ 2012-08-05  9:52 Julia Lawall
  2012-08-05  9:52 ` [PATCH 1/6] drivers/edac/i7core_edac.c: " Julia Lawall
                   ` (5 more replies)
  0 siblings, 6 replies; 12+ messages in thread
From: Julia Lawall @ 2012-08-05  9:52 UTC (permalink / raw)
  To: linux-kernel; +Cc: kernel-janitors

These patches fix cases where the return code appears to be unintentially 0.

The complete semantic match that finds the problem is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@r@
identifier f;
expression ret,e;
constant C;
@@

f(...) { <+...
(
return -C;
|
ret = -C
... when != ret = e
return ret;
|
if (ret < 0) { ... return ret; }
)
...+> }

@s@
identifier r.f,ret;
@@

f(...) { <+... return ret; ...+> }

@@
identifier r.f,s.ret;
expression e,e1,e2,e3,e4,x;
@@

f(...) { <+...
(
if (\(ret != 0\|ret < 0\) || ...) { ... return ...; }
|
ret = 0
)
... when != ret = e1
*x = \(kmalloc\|kzalloc\|kcalloc\|devm_kzalloc\|ioremap\|ioremap_nocache\|devm_ioremap\|devm_ioremap_nocache\)(...);
... when != x = e2
    when != ret = e3
*if (x == NULL || ...)
{
  ... when != ret = e4
*  return ret;
}
...+> }
// </smpl>


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

end of thread, other threads:[~2012-10-02 11:04 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-05  9:52 [PATCH 0/6] fix error return code Julia Lawall
2012-08-05  9:52 ` [PATCH 1/6] drivers/edac/i7core_edac.c: " Julia Lawall
2012-08-05  9:52 ` [PATCH 2/6] drivers/cpufreq/pcc-cpufreq.c: " Julia Lawall
2012-08-05 21:11   ` Rafael J. Wysocki
2012-08-05  9:52 ` [PATCH 3/6] arch/powerpc/kvm/e500_tlb.c: " Julia Lawall
2012-10-02 11:04   ` Alexander Graf
2012-08-05  9:52 ` [PATCH 4/6] drivers/gpio/gpio-langwell.c: " Julia Lawall
2012-08-05 19:10   ` Linus Walleij
2012-08-05  9:52 ` [PATCH 5/6] drivers/char/tlclk.c: " Julia Lawall
2012-08-06  3:22   ` Gross, Mark
2012-08-05  9:52 ` [PATCH 6/6] drivers/atm/iphase.c: " Julia Lawall
2012-08-06 20:30   ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®