* Re: [PATCH] return hidden bug
2007-10-22 1:42 ` Rik van Riel
@ 2007-10-22 1:53 ` Roel Kluin
2007-10-22 3:08 ` Rik van Riel
2007-10-22 5:02 ` Herbert Xu
` (3 subsequent siblings)
4 siblings, 1 reply; 16+ messages in thread
From: Roel Kluin @ 2007-10-22 1:53 UTC (permalink / raw)
To: Rik van Riel; +Cc: lkml
Rik van Riel wrote:
> On Mon, 22 Oct 2007 03:05:05 +0200
> Roel Kluin <12o3l@tiscali.nl> wrote:
>
>> return hidden bug
>>
>> Signed-off-by: Roel Kluin <12o3l@tiscali.nl>
>>
>> diff --git a/arch/alpha/kernel/pci_iommu.c
>> b/arch/alpha/kernel/pci_iommu.c index e1c4707..6a69425 100644
>> --- a/arch/alpha/kernel/pci_iommu.c
>> +++ b/arch/alpha/kernel/pci_iommu.c
>> @@ -365,8 +365,8 @@ pci_unmap_single(struct pci_dev *pdev, dma_addr_t
>> dma_addr, size_t size, printk(KERN_ERR "Bogus pci_unmap_single:
>> dma_addr %lx " " base %lx size %x\n", dma_addr, arena->dma_base,
>> arena->size);
>> - return;
>> BUG();
>> + return;
>> }
>>
>> npages = calc_npages((dma_addr & ~PAGE_MASK) + size);
>
> BUG() will terminate the process that runs into it, so you can
> just remove the return alltogether. If BUG() is hit, the return
> will never be reached.
>
---
hidden bug returns
Signed-off-by: Roel Kluin <12o3l@tiscali.nl>
---
diff --git a/arch/alpha/kernel/pci_iommu.c b/arch/alpha/kernel/pci_iommu.c
index e1c4707..ca55c33 100644
--- a/arch/alpha/kernel/pci_iommu.c
+++ b/arch/alpha/kernel/pci_iommu.c
@@ -365,7 +365,6 @@ pci_unmap_single(struct pci_dev *pdev, dma_addr_t dma_addr, size_t size,
printk(KERN_ERR "Bogus pci_unmap_single: dma_addr %lx "
" base %lx size %x\n", dma_addr, arena->dma_base,
arena->size);
- return;
BUG();
}
^ permalink raw reply related [flat|nested] 16+ messages in thread* Re: [PATCH] return hidden bug
2007-10-22 1:53 ` Roel Kluin
@ 2007-10-22 3:08 ` Rik van Riel
0 siblings, 0 replies; 16+ messages in thread
From: Rik van Riel @ 2007-10-22 3:08 UTC (permalink / raw)
To: Roel Kluin; +Cc: lkml
On Mon, 22 Oct 2007 03:53:30 +0200
Roel Kluin <12o3l@tiscali.nl> wrote:
> hidden bug returns
>
> Signed-off-by: Roel Kluin <12o3l@tiscali.nl>
Acked-by: Rik van Riel <riel@redhat.com>
--
"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it." - Brian W. Kernighan
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] return hidden bug
2007-10-22 1:42 ` Rik van Riel
2007-10-22 1:53 ` Roel Kluin
@ 2007-10-22 5:02 ` Herbert Xu
2007-10-22 9:30 ` Pekka Enberg
` (2 subsequent siblings)
4 siblings, 0 replies; 16+ messages in thread
From: Herbert Xu @ 2007-10-22 5:02 UTC (permalink / raw)
To: Rik van Riel; +Cc: Roel Kluin, lkml
On Mon, Oct 22, 2007 at 01:42:09AM +0000, Rik van Riel wrote:
>
> BUG() will terminate the process that runs into it, so you can
> just remove the return alltogether. If BUG() is hit, the return
> will never be reached.
This is true in general. However, if someone builds the kernel
with CONFIG_BUG disabled then the return statement will make a
difference. Of course, if you're brave enough to have CONFIG_BUG
off then you can deal with the fall-out :)
Cheers,
--
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply [flat|nested] 16+ messages in thread* Re: [PATCH] return hidden bug
2007-10-22 1:42 ` Rik van Riel
2007-10-22 1:53 ` Roel Kluin
2007-10-22 5:02 ` Herbert Xu
@ 2007-10-22 9:30 ` Pekka Enberg
2007-10-22 15:19 ` Rik van Riel
2007-10-22 16:42 ` Ray Lee
2007-10-22 18:36 ` Matt Mackall
4 siblings, 1 reply; 16+ messages in thread
From: Pekka Enberg @ 2007-10-22 9:30 UTC (permalink / raw)
To: Rik van Riel; +Cc: Roel Kluin, lkml
Hi,
On 10/22/07, Rik van Riel <riel@redhat.com> wrote:
> BUG() will terminate the process that runs into it, so you can
> just remove the return alltogether. If BUG() is hit, the return
> will never be reached.
This isn't true when CONFIG_BUG is disabled (in embedded builds, for example).
Pekka
^ permalink raw reply [flat|nested] 16+ messages in thread* Re: [PATCH] return hidden bug
2007-10-22 9:30 ` Pekka Enberg
@ 2007-10-22 15:19 ` Rik van Riel
2007-10-22 15:23 ` Pekka Enberg
0 siblings, 1 reply; 16+ messages in thread
From: Rik van Riel @ 2007-10-22 15:19 UTC (permalink / raw)
To: Pekka Enberg; +Cc: Roel Kluin, lkml
On Mon, 22 Oct 2007 12:30:00 +0300
"Pekka Enberg" <penberg@cs.helsinki.fi> wrote:
> On 10/22/07, Rik van Riel <riel@redhat.com> wrote:
> > BUG() will terminate the process that runs into it, so you can
> > just remove the return alltogether. If BUG() is hit, the return
> > will never be reached.
>
> This isn't true when CONFIG_BUG is disabled (in embedded builds, for
> example).
*blink*
I guess people who disable CONFIG_BUG really choose to shoot themselves
in the foot when something bad happens. The kernel is full of error
paths where the current thread really should not be continuing.
Oh well...
--
"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it." - Brian W. Kernighan
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] return hidden bug
2007-10-22 15:19 ` Rik van Riel
@ 2007-10-22 15:23 ` Pekka Enberg
0 siblings, 0 replies; 16+ messages in thread
From: Pekka Enberg @ 2007-10-22 15:23 UTC (permalink / raw)
To: Rik van Riel; +Cc: Roel Kluin, lkml
Hi Rik,
On 10/22/07, Rik van Riel <riel@redhat.com> wrote:
> On Mon, 22 Oct 2007 12:30:00 +0300
> I guess people who disable CONFIG_BUG really choose to shoot themselves
> in the foot when something bad happens. The kernel is full of error
> paths where the current thread really should not be continuing.
Sure, if you disable BUG_ON, it may or may not work. But making it
*worse* on purpose seems pointless.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] return hidden bug
2007-10-22 1:42 ` Rik van Riel
` (2 preceding siblings ...)
2007-10-22 9:30 ` Pekka Enberg
@ 2007-10-22 16:42 ` Ray Lee
2007-10-22 17:56 ` Roel Kluin
2007-10-22 18:36 ` Matt Mackall
4 siblings, 1 reply; 16+ messages in thread
From: Ray Lee @ 2007-10-22 16:42 UTC (permalink / raw)
To: Rik van Riel; +Cc: Roel Kluin, lkml
On 10/21/07, Rik van Riel <riel@redhat.com> wrote:
> On Mon, 22 Oct 2007 03:05:05 +0200
> Roel Kluin <12o3l@tiscali.nl> wrote:
>
> > return hidden bug
> >
> > Signed-off-by: Roel Kluin <12o3l@tiscali.nl>
> >
> > diff --git a/arch/alpha/kernel/pci_iommu.c
> > b/arch/alpha/kernel/pci_iommu.c index e1c4707..6a69425 100644
> > --- a/arch/alpha/kernel/pci_iommu.c
> > +++ b/arch/alpha/kernel/pci_iommu.c
> > @@ -365,8 +365,8 @@ pci_unmap_single(struct pci_dev *pdev, dma_addr_t
> > dma_addr, size_t size, printk(KERN_ERR "Bogus pci_unmap_single:
> > dma_addr %lx " " base %lx size %x\n", dma_addr, arena->dma_base,
> > arena->size);
> > - return;
> > BUG();
> > + return;
> > }
> >
> > npages = calc_npages((dma_addr & ~PAGE_MASK) + size);
>
> BUG() will terminate the process that runs into it, so you can
> just remove the return alltogether. If BUG() is hit, the return
> will never be reached.
I'm sorry, perhaps I poured myself a cup of stupid this morning, but
isn't the above patch effectively introducing a BUG where none could
be reached before? In other words, for the patch to have zero
behavioral change, wouldn't it have to remove the BUG() altogether?
Ray
^ permalink raw reply [flat|nested] 16+ messages in thread* Re: [PATCH] return hidden bug
2007-10-22 16:42 ` Ray Lee
@ 2007-10-22 17:56 ` Roel Kluin
2007-10-22 18:12 ` Ray Lee
0 siblings, 1 reply; 16+ messages in thread
From: Roel Kluin @ 2007-10-22 17:56 UTC (permalink / raw)
To: Ray Lee; +Cc: Rik van Riel, lkml
Ray Lee wrote:
> I'm sorry, perhaps I poured myself a cup of stupid this morning, but
> isn't the above patch effectively introducing a BUG where none could
> be reached before? In other words, for the patch to have zero
> behavioral change, wouldn't it have to remove the BUG() altogether?
True, but obviously not intended. I think the intention was to expose this bug.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] return hidden bug
2007-10-22 17:56 ` Roel Kluin
@ 2007-10-22 18:12 ` Ray Lee
2007-10-22 18:52 ` Roel Kluin
0 siblings, 1 reply; 16+ messages in thread
From: Ray Lee @ 2007-10-22 18:12 UTC (permalink / raw)
To: Roel Kluin; +Cc: Rik van Riel, lkml
On 10/22/07, Roel Kluin <12o3l@tiscali.nl> wrote:
> Ray Lee wrote:
>
> > I'm sorry, perhaps I poured myself a cup of stupid this morning, but
> > isn't the above patch effectively introducing a BUG where none could
> > be reached before? In other words, for the patch to have zero
> > behavioral change, wouldn't it have to remove the BUG() altogether?
>
> True, but obviously not intended. I think the intention was to expose this bug.
Arguing intentions is very dangerous. I've written code like that
where the intention is to make it simple to turn a printk into a full
bug and back and forth during development. At the end of the day, the
fact remains that you're changing behavior.
Let me turn this around. Do you have an alpha and have you tried out
your patch? If not, then I'd suggest turning it into a WARN_ON(1)
instead, as in this specific case you're risking turning what was a
working system into one that doesn't.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] return hidden bug
2007-10-22 18:12 ` Ray Lee
@ 2007-10-22 18:52 ` Roel Kluin
2007-10-22 22:26 ` Rene Herman
0 siblings, 1 reply; 16+ messages in thread
From: Roel Kluin @ 2007-10-22 18:52 UTC (permalink / raw)
To: Ray Lee; +Cc: Rik van Riel, lkml
Ray Lee wrote:
>>> I'm sorry, perhaps I poured myself a cup of stupid this morning, but
>>> isn't the above patch effectively introducing a BUG where none could
>>> be reached before? In other words, for the patch to have zero
>>> behavioral change, wouldn't it have to remove the BUG() altogether?
>> True, but obviously not intended. I think the intention was to expose this bug.
>
> Arguing intentions is very dangerous. I've written code like that
> where the intention is to make it simple to turn a printk into a full
> bug and back and forth during development. At the end of the day, the
> fact remains that you're changing behavior.
>
> Let me turn this around. Do you have an alpha and have you tried out
> your patch? If not, then I'd suggest turning it into a WARN_ON(1)
> instead, as in this specific case you're risking turning what was a
> working system into one that doesn't.
No, I haven't and, I will change it, but it's included with my other
changes. see the reply that I'll write shortly for.
[PATCH retry] return hidden bug and unlock bugs.
Roel
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] return hidden bug
2007-10-22 18:52 ` Roel Kluin
@ 2007-10-22 22:26 ` Rene Herman
2007-10-22 23:00 ` Ray Lee
0 siblings, 1 reply; 16+ messages in thread
From: Rene Herman @ 2007-10-22 22:26 UTC (permalink / raw)
To: Roel Kluin; +Cc: Ray Lee, Rik van Riel, lkml
On 10/22/2007 08:52 PM, Roel Kluin wrote:
> Ray Lee wrote:
>> Arguing intentions is very dangerous. I've written code like that
>> where the intention is to make it simple to turn a printk into a full
>> bug and back and forth during development. At the end of the day, the
>> fact remains that you're changing behavior.
>>
>> Let me turn this around. Do you have an alpha and have you tried out
>> your patch? If not, then I'd suggest turning it into a WARN_ON(1)
>> instead, as in this specific case you're risking turning what was a
>> working system into one that doesn't.
>
> No, I haven't and, I will change it, but it's included with my other
> changes. see the reply that I'll write shortly for.
> [PATCH retry] return hidden bug and unlock bugs.
Hugely trust inspiring isn't it -- the amount of eyes and comments you'll
get even on trivial patches like this? This development model is working!
Now if only we'd sometimes get some for non trivial patches as well...
Rene.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] return hidden bug
2007-10-22 22:26 ` Rene Herman
@ 2007-10-22 23:00 ` Ray Lee
2007-10-23 0:15 ` Rene Herman
0 siblings, 1 reply; 16+ messages in thread
From: Ray Lee @ 2007-10-22 23:00 UTC (permalink / raw)
To: Rene Herman; +Cc: Roel Kluin, Rik van Riel, lkml
On 10/22/07, Rene Herman <rene.herman@keyaccess.nl> wrote:
> Hugely trust inspiring isn't it -- the amount of eyes and comments you'll
> get even on trivial patches like this? This development model is working!
Go easy with the snarkiness, hmm? It's the trivial ones that seem to
be the most dangerous. The larger ones actually get *tested*
sometimes.
> Now if only we'd sometimes get some for non trivial patches as well...
That's certainly true regardless, but for myself, I'd rather throw
some reviews out for the small ones since I have adequate time and
knowledge for them. The larger ones require domain specific knowledge
I lack, and time I don't have.
~r.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] return hidden bug
2007-10-22 23:00 ` Ray Lee
@ 2007-10-23 0:15 ` Rene Herman
0 siblings, 0 replies; 16+ messages in thread
From: Rene Herman @ 2007-10-23 0:15 UTC (permalink / raw)
To: Ray Lee; +Cc: Roel Kluin, Rik van Riel, lkml
On 10/23/2007 01:00 AM, Ray Lee wrote:
> On 10/22/07, Rene Herman <rene.herman@keyaccess.nl> wrote:
>> Hugely trust inspiring isn't it -- the amount of eyes and comments you'll
>> get even on trivial patches like this? This development model is working!
>
> Go easy with the snarkiness, hmm? It's the trivial ones that seem to
> be the most dangerous. The larger ones actually get *tested*
> sometimes.
I was also commenting and don't generally on anything much more involved so
any snarkiness included myself which should make things better.
>> Now if only we'd sometimes get some for non trivial patches as well...
>
> That's certainly true regardless, but for myself, I'd rather throw
> some reviews out for the small ones since I have adequate time and
> knowledge for them. The larger ones require domain specific knowledge
> I lack, and time I don't have.
Exactly the problem. Comment was mostly triggered due to me looking at a
problem with a proprietary CD-ROM driver again tonight that I posted a few
months ago where the only comment has been from the fellow author. There the
problem was the block layer blowing up and given that it seems unlikely that
this wouldn't be a problem inside the newbie-driver itself, that the block
part of it was actually really small and people said they'd look at it, the
subsequent thundering silence still annoys me.
Ofcourse, now it seems the kernel itself has moved on enough that the driver
doesn't work at _all_ anymore and I at the moment lack the time to spend the
required hours googling around trying to find out what the heck changed out
from under me so that I might get it to at least do what it already did do.
Hey, I don't actually know and maybe I'm just wrong but I have the feeling
that over the last 1 or 2 years most new developers seem to be either people
that are payed to be so, perhaps in the form of graduation, or janitors. The
kernel is much, much more complex than even only a few years ago and at the
same time the number of knowledgeable developers who'll do something other
than their own thing and otherwise just wait around for something perfect to
merge seems to be approaching zero.
That is -- I do not feel that the current developer base is expending overly
many efforts to appear welcoming.
Please feel free to do the open-source thing and argue that's actually an
advantage (there we have that snarkiness again...) or otherwise ignore me.
I'll just sit here and be grumpy anyway. Might be better after a good
night's sleep...
Rene.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] return hidden bug
2007-10-22 1:42 ` Rik van Riel
` (3 preceding siblings ...)
2007-10-22 16:42 ` Ray Lee
@ 2007-10-22 18:36 ` Matt Mackall
4 siblings, 0 replies; 16+ messages in thread
From: Matt Mackall @ 2007-10-22 18:36 UTC (permalink / raw)
To: Rik van Riel; +Cc: Roel Kluin, lkml
On Sun, Oct 21, 2007 at 09:42:09PM -0400, Rik van Riel wrote:
> On Mon, 22 Oct 2007 03:05:05 +0200
> Roel Kluin <12o3l@tiscali.nl> wrote:
>
> > return hidden bug
> >
> > Signed-off-by: Roel Kluin <12o3l@tiscali.nl>
> >
> > diff --git a/arch/alpha/kernel/pci_iommu.c
> > b/arch/alpha/kernel/pci_iommu.c index e1c4707..6a69425 100644
> > --- a/arch/alpha/kernel/pci_iommu.c
> > +++ b/arch/alpha/kernel/pci_iommu.c
> > @@ -365,8 +365,8 @@ pci_unmap_single(struct pci_dev *pdev, dma_addr_t
> > dma_addr, size_t size, printk(KERN_ERR "Bogus pci_unmap_single:
> > dma_addr %lx " " base %lx size %x\n", dma_addr, arena->dma_base,
> > arena->size);
> > - return;
> > BUG();
> > + return;
> > }
> >
> > npages = calc_npages((dma_addr & ~PAGE_MASK) + size);
>
> BUG() will terminate the process that runs into it, so you can
> just remove the return alltogether. If BUG() is hit, the return
> will never be reached.
Looking at the printk, I don't think this particular error ought to
forcefully kill things.
--
Mathematics is the supreme nostalgia of our time.
^ permalink raw reply [flat|nested] 16+ messages in thread