From: wharms@bfs.de (walter harms)
To: cocci@systeme.lip6.fr
Subject: [Cocci] coccinelle and bitmask arithmetic
Date: Wed, 30 Jan 2013 09:21:28 +0100 [thread overview]
Message-ID: <5108D808.6010405@bfs.de> (raw)
In-Reply-To: <1359482637.15135.7.camel@joe-AO722>
Am 29.01.2013 19:03, schrieb Joe Perches:
> On Tue, 2013-01-29 at 18:49 +0100, Julia Lawall wrote:
>> How about the following (from today's linux-next). They appear to be
>> trying to do the same calculation, once with + and once with |.
>
> (cc'ing the original developer and Russell King)
>
> Likely the it8152_pci_platform_notify uses should use +
>
>> arch/arm/common/it8152.c
>>
>> int dma_set_coherent_mask(struct device *dev, u64 mask)
>> {
>> if (mask >= PHYS_OFFSET + SZ_64M - 1)
>> return 0;
>>
>> return -EIO;
>> }
>>
Great hit Joe :)
Sometimes i am really surprised what code can be found
in the kernal and it is still working.
Having no clue of the code i suspect somebody tries to
check is mask outside the range it should read
PHYS_OFFSET |( SZ_64M - 1)
maybe someone should tell them that
1+1=10 while 1|1=1
It does not seem to matter here (or ... ?)
really perplexed,
wh
>> static int it8152_pci_platform_notify(struct device *dev)
>> {
>> if (dev->bus == &pci_bus_type) {
>> if (dev->dma_mask)
>> *dev->dma_mask = (SZ_64M - 1) | PHYS_OFFSET;
>> dev->coherent_dma_mask = (SZ_64M - 1) | PHYS_OFFSET;
>> dmabounce_register_dev(dev, 2048, 4096, it8152_needs_bounce);
>> }
>> return 0;
>> }
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> the body of a message to majordomo at vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
>
WARNING: multiple messages have this Message-ID (diff)
From: walter harms <wharms@bfs.de>
To: cocci@systeme.lip6.fr
Subject: Re: coccinelle and bitmask arithmetic
Date: Wed, 30 Jan 2013 08:21:28 +0000 [thread overview]
Message-ID: <5108D808.6010405@bfs.de> (raw)
In-Reply-To: <1359482637.15135.7.camel@joe-AO722>
Am 29.01.2013 19:03, schrieb Joe Perches:
> On Tue, 2013-01-29 at 18:49 +0100, Julia Lawall wrote:
>> How about the following (from today's linux-next). They appear to be
>> trying to do the same calculation, once with + and once with |.
>
> (cc'ing the original developer and Russell King)
>
> Likely the it8152_pci_platform_notify uses should use +
>
>> arch/arm/common/it8152.c
>>
>> int dma_set_coherent_mask(struct device *dev, u64 mask)
>> {
>> if (mask >= PHYS_OFFSET + SZ_64M - 1)
>> return 0;
>>
>> return -EIO;
>> }
>>
Great hit Joe :)
Sometimes i am really surprised what code can be found
in the kernal and it is still working.
Having no clue of the code i suspect somebody tries to
check is mask outside the range it should read
PHYS_OFFSET |( SZ_64M - 1)
maybe someone should tell them that
1+1\x10 while 1|1=1
It does not seem to matter here (or ... ?)
really perplexed,
wh
>> static int it8152_pci_platform_notify(struct device *dev)
>> {
>> if (dev->bus = &pci_bus_type) {
>> if (dev->dma_mask)
>> *dev->dma_mask = (SZ_64M - 1) | PHYS_OFFSET;
>> dev->coherent_dma_mask = (SZ_64M - 1) | PHYS_OFFSET;
>> dmabounce_register_dev(dev, 2048, 4096, it8152_needs_bounce);
>> }
>> return 0;
>> }
>
>
> --
> 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
>
>
WARNING: multiple messages have this Message-ID (diff)
From: walter harms <wharms@bfs.de>
To: Joe Perches <joe@perches.com>
Cc: Julia Lawall <julia.lawall@lip6.fr>,
Russell King <linux@arm.linux.org.uk>,
Mike Rapoport <mike@compulab.co.il>,
Valdis.Kletnieks@vt.edu, cocci@systeme.lip6.fr,
Dan Carpenter <dan.carpenter@oracle.com>,
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
Date: Wed, 30 Jan 2013 09:21:28 +0100 [thread overview]
Message-ID: <5108D808.6010405@bfs.de> (raw)
In-Reply-To: <1359482637.15135.7.camel@joe-AO722>
Am 29.01.2013 19:03, schrieb Joe Perches:
> On Tue, 2013-01-29 at 18:49 +0100, Julia Lawall wrote:
>> How about the following (from today's linux-next). They appear to be
>> trying to do the same calculation, once with + and once with |.
>
> (cc'ing the original developer and Russell King)
>
> Likely the it8152_pci_platform_notify uses should use +
>
>> arch/arm/common/it8152.c
>>
>> int dma_set_coherent_mask(struct device *dev, u64 mask)
>> {
>> if (mask >= PHYS_OFFSET + SZ_64M - 1)
>> return 0;
>>
>> return -EIO;
>> }
>>
Great hit Joe :)
Sometimes i am really surprised what code can be found
in the kernal and it is still working.
Having no clue of the code i suspect somebody tries to
check is mask outside the range it should read
PHYS_OFFSET |( SZ_64M - 1)
maybe someone should tell them that
1+1=10 while 1|1=1
It does not seem to matter here (or ... ?)
really perplexed,
wh
>> static int it8152_pci_platform_notify(struct device *dev)
>> {
>> if (dev->bus == &pci_bus_type) {
>> if (dev->dma_mask)
>> *dev->dma_mask = (SZ_64M - 1) | PHYS_OFFSET;
>> dev->coherent_dma_mask = (SZ_64M - 1) | PHYS_OFFSET;
>> dmabounce_register_dev(dev, 2048, 4096, it8152_needs_bounce);
>> }
>> return 0;
>> }
>
>
> --
> 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
>
>
next prev parent reply other threads:[~2013-01-30 8:21 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 ` [Cocci] " Dan Carpenter
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 ` walter harms [this message]
2013-01-30 8:21 ` coccinelle and bitmask arithmetic 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=5108D808.6010405@bfs.de \
--to=wharms@bfs.de \
--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.