kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/7] adjust suspicious bit operation
@ 2012-06-06 21:41 Julia Lawall
  2012-06-06 21:41 ` [PATCH 1/7] drivers/ide/ide-cs.c: " Julia Lawall
                   ` (6 more replies)
  0 siblings, 7 replies; 24+ messages in thread
From: Julia Lawall @ 2012-06-06 21:41 UTC (permalink / raw)
  To: linux-kernel; +Cc: kernel-janitors

These patches relate to conditional tests where & is used with a constant
that is always 0 and where | is used with a constant that is always 0 or
always non-zero.

The following semantic match finds these problems
(http://coccinelle.lip6.fr/):

@and@
identifier i;
expression e;
position p;
@@

 ((e & i@p) && ...)

@iszera@
identifier and.i;
position p;
@@

#define i 0

@othera@
identifier and.i;
expression e!=0;
@@

#define i e

@script:python depends on iszera && !othera@
p << and.p;
@@

cocci.print_main("",p)

@or@
identifier i;
expression e;
position p;
@@

 ((e | i@p) && ...)


@iszero@
identifier or.i;
position p;
@@

#define i 0

@othero@
identifier or.i;
expression e!=0;
@@

#define i e

@script:python depends on (othero && !iszero) || (iszero && !othero)@
p << or.p;
@@

cocci.print_main("",p)


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

end of thread, other threads:[~2012-06-12 22:52 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-06 21:41 [PATCH 0/7] adjust suspicious bit operation Julia Lawall
2012-06-06 21:41 ` [PATCH 1/7] drivers/ide/ide-cs.c: " Julia Lawall
2012-06-07 21:46   ` David Miller
2012-06-07 21:59     ` Joe Perches
2012-06-08  5:12     ` Julia Lawall
2012-06-08  5:14     ` Julia Lawall
2012-06-08  7:30       ` walter harms
2012-06-11 23:43       ` David Miller
2012-06-12 14:17         ` Julia Lawall
2012-06-12 22:52           ` David Miller
2012-06-06 21:41 ` [PATCH 2/7] drivers/staging/comedi/drivers/me4000.c: " Julia Lawall
2012-06-06 21:41 ` [PATCH 3/7] drivers/usb/gadget/pch_udc.c: " Julia Lawall
2012-06-07 13:00   ` Sergei Shtylyov
2012-06-07 14:23     ` Julia Lawall
2012-06-07 15:05       ` Joe Perches
2012-06-08 12:58         ` Dan Carpenter
2012-06-08 15:28           ` Joe Perches
2012-06-06 21:41 ` [PATCH 4/7] fs/direct-io.c: " Julia Lawall
2012-06-07 14:24   ` Jeff Moyer
2012-06-06 21:41 ` [PATCH 5/7] drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c: " Julia Lawall
2012-06-06 23:43   ` [PATCH 5/7] drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c: adjust suspicious bit Franky Lin
2012-06-06 21:41 ` [PATCH 6/7] drivers/ata/pata_pcmcia.c: adjust suspicious bit operation Julia Lawall
2012-06-06 21:41 ` [PATCH 7/7] drivers/net/can/cc770/cc770_platform.c: " Julia Lawall
2012-06-06 21:52   ` Marc Kleine-Budde

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).