Re: [PATCH] Fix up uses of BUG

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 3 Jul 2008 04:02:50 -0500
"Stoyan Gaydarov" <stoyboyker@xxxxxxxxx> wrote:

> This is a patch based on the linux-2.6.26-rc8 kernel and it changes
> the if(condition) BUG(); to the more desirable BUG_ON(condition);
> 
> diff -uprN vanila/linux-2.6.26-rc8/fs/afs/rxrpc.c devel/fs/afs/rxrpc.c
> --- vanila/linux-2.6.26-rc8/fs/afs/rxrpc.c      2008-07-03
> 03:28:52.000000000 -0500
> +++ devel/fs/afs/rxrpc.c        2008-07-03 03:31:40.000000000 -0500
> @@ -139,8 +139,7 @@ static void afs_data_delivered(struct sk
>         } else {
>                 _debug("DLVR %p{%u} [%d]",
>                        skb, skb->mark, atomic_read(&afs_outstanding_skbs));
> -               if (atomic_dec_return(&afs_outstanding_skbs) == -1)
> -                       BUG();
> +               BUG_ON(atomic_dec_return(&afs_outstanding_skbs) == -1);

This is a problem.

Some embedded people compile their kernel without any debugging
whatsoever, and will happily "#define BUG_ON(x) /* nothing */".

This is OK for something like BUG_ON(a == NULL) because that
only tests a variable (it has no side effects).

However, your patch would mean that the atomic_dec_return()
would not be executed at all in those configurations!

-- 
All rights reversed.

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux