All of lore.kernel.org
 help / color / mirror / Atom feed
From: dan.carpenter@oracle.com (Dan Carpenter)
To: cocci@systeme.lip6.fr
Subject: [Cocci] coccinelle and bitmask arithmetic (was: Re: [patch] TTY: synclink, small cleanup in dtr_rts())
Date: Tue, 29 Jan 2013 20:30:05 +0300	[thread overview]
Message-ID: <20130129173004.GP16282@mwanda> (raw)
In-Reply-To: <alpine.DEB.2.02.1301291717530.3339@hadrien>

On Tue, Jan 29, 2013 at 05:19:43PM +0100, Julia Lawall wrote:
> If the definition of a bitmask is an identifier in all capital letters,
> that would be easy.  Another possibility is such an identifier that is
> defined to a value expressed beginning with 0x.  Another possibility is
> such an identifier that is sometimes used with & and | and sometimes used
> with an arithmetic operation.  I will give them a try.
> 

Oddly enough, this thread started because I wrote a script to do
this in Smatch.  It turns out not as useful as I had hoped, so I
wasn't planning to push it.

Anyway, I've gzipped it and attached it.  It's 350k because it has
a list of 50k macros which were used as bit masks.  Hopefully, it's
helpful.

It generates 350 warnings, but they are almost all false positives.
I have sent two patches based on the output.

regards,
dan carpenter

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-check_bit_masks-complain-if-bitmasks-are-used-for-ma.patch.gz
Type: application/octet-stream
Size: 353926 bytes
Desc: not available
URL: <https://systeme.lip6.fr/pipermail/cocci/attachments/20130129/bbf83b14/attachment-0001.obj>

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Julia Lawall <julia.lawall@lip6.fr>
Cc: Joe Perches <joe@perches.com>,
	Valdis.Kletnieks@vt.edu, cocci@systeme.lip6.fr,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jiri Slaby <jslaby@suse.cz>, Paul Fulghum <paulkf@microgate.com>,
	David Howells <dhowells@redhat.com>,
	linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: coccinelle and bitmask arithmetic (was: Re: [patch] TTY: synclink, small cleanup in dtr_rts())
Date: Tue, 29 Jan 2013 20:30:05 +0300	[thread overview]
Message-ID: <20130129173004.GP16282@mwanda> (raw)
In-Reply-To: <alpine.DEB.2.02.1301291717530.3339@hadrien>

[-- Attachment #1: Type: text/plain, Size: 862 bytes --]

On Tue, Jan 29, 2013 at 05:19:43PM +0100, Julia Lawall wrote:
> If the definition of a bitmask is an identifier in all capital letters,
> that would be easy.  Another possibility is such an identifier that is
> defined to a value expressed beginning with 0x.  Another possibility is
> such an identifier that is sometimes used with & and | and sometimes used
> with an arithmetic operation.  I will give them a try.
> 

Oddly enough, this thread started because I wrote a script to do
this in Smatch.  It turns out not as useful as I had hoped, so I
wasn't planning to push it.

Anyway, I've gzipped it and attached it.  It's 350k because it has
a list of 50k macros which were used as bit masks.  Hopefully, it's
helpful.

It generates 350 warnings, but they are almost all false positives.
I have sent two patches based on the output.

regards,
dan carpenter


[-- Attachment #2: 0001-check_bit_masks-complain-if-bitmasks-are-used-for-ma.patch.gz --]
[-- Type: application/octet-stream, Size: 353926 bytes --]

  parent reply	other threads:[~2013-01-29 17:30 UTC|newest]

Thread overview: 60+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-27 19:40 [patch] TTY: synclink, small cleanup in dtr_rts() Dan Carpenter
2013-01-27 19:40 ` Dan Carpenter
2013-01-27 20:04 ` Joe Perches
2013-01-27 20:04   ` Joe Perches
2013-01-27 20:16   ` Jiri Slaby
2013-01-27 20:16     ` Jiri Slaby
2013-01-27 20:19   ` Dan Carpenter
2013-01-27 20:19     ` Dan Carpenter
2013-01-27 21:00     ` Joe Perches
2013-01-27 21:00       ` Joe Perches
     [not found]       ` <C8AFB2C4-4974-4265-A41C-A56C71784F39@microgate.com>
2013-01-28  2:21         ` [PATCH] TTY: synclink: Convert + to | for bit operations Joe Perches
2013-01-28  2:21           ` Joe Perches
2013-01-28 12:06       ` [patch] TTY: synclink, small cleanup in dtr_rts() walter harms
2013-01-28 12:06         ` walter harms
2013-01-29 15:55     ` Valdis.Kletnieks
2013-01-29 15:55       ` Valdis.Kletnieks
2013-01-29 16:13       ` [Cocci] coccinelle and bitmask arithmetic (was: Re: [patch] TTY: synclink, small cleanup in dtr_rts()) Joe Perches
2013-01-29 16:13         ` Joe Perches
2013-01-29 16:13         ` Joe Perches
2013-01-29 16:19         ` [Cocci] " Julia Lawall
2013-01-29 16:19           ` Julia Lawall
2013-01-29 16:19           ` Julia Lawall
2013-01-29 16:31           ` [Cocci] " Joe Perches
2013-01-29 16:31             ` Joe Perches
2013-01-29 16:31             ` Joe Perches
2013-01-29 17:30           ` Dan Carpenter [this message]
2013-01-29 17:30             ` Dan Carpenter
2013-01-29 17:42             ` [Cocci] " Dan Carpenter
2013-01-29 17:42               ` Dan Carpenter
2013-01-29 17:42               ` Dan Carpenter
2013-01-29 17:49         ` [Cocci] " Julia Lawall
2013-01-29 17:49           ` Julia Lawall
2013-01-29 17:49           ` Julia Lawall
2013-01-29 18:03           ` [Cocci] " Joe Perches
2013-01-29 18:03             ` Joe Perches
2013-01-29 18:03             ` Joe Perches
2013-01-30  8:21             ` [Cocci] coccinelle and bitmask arithmetic walter harms
2013-01-30  8:21               ` walter harms
2013-01-30  8:21               ` walter harms
2013-01-30  8:29               ` [Cocci] " Joe Perches
2013-01-30  8:29                 ` Joe Perches
2013-01-30  8:29                 ` Joe Perches
2013-01-30 11:14               ` [Cocci] " Russell King - ARM Linux
2013-01-30 11:14                 ` Russell King - ARM Linux
2013-01-30 11:14                 ` Russell King - ARM Linux
2013-01-30 11:21                 ` [Cocci] " Julia Lawall
2013-01-30 11:21                   ` Julia Lawall
2013-01-30 11:21                   ` Julia Lawall
2013-01-30 11:35                   ` [Cocci] " Russell King - ARM Linux
2013-01-30 11:35                     ` Russell King - ARM Linux
2013-01-30 11:35                     ` Russell King - ARM Linux
2013-01-30 16:53                     ` [Cocci] " Joe Perches
2013-01-30 16:53                       ` Joe Perches
2013-01-30 16:53                       ` Joe Perches
2013-01-30 18:23                       ` [Cocci] " Russell King - ARM Linux
2013-01-30 18:23                         ` Russell King - ARM Linux
2013-01-30 18:23                         ` Russell King - ARM Linux
2013-01-29 18:38         ` [Cocci] coccinelle and bitmask arithmetic (was: Re: [patch] TTY: synclink, small cleanup in dtr_rts()) Julia Lawall
2013-01-29 18:38           ` Julia Lawall
2013-01-29 18:38           ` Julia Lawall

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130129173004.GP16282@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=cocci@systeme.lip6.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.