public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Remove useless assertions from reiserfs
@ 2003-08-11 16:48 davej
  2003-08-11 17:45 ` Jeff Garzik
  0 siblings, 1 reply; 7+ messages in thread
From: davej @ 2003-08-11 16:48 UTC (permalink / raw)
  To: torvalds; +Cc: linux-kernel

diff -urpN --exclude-from=/home/davej/.exclude bk-linus/fs/reiserfs/hashes.c linux-2.5/fs/reiserfs/hashes.c
--- bk-linus/fs/reiserfs/hashes.c	2003-04-10 06:01:29.000000000 +0100
+++ linux-2.5/fs/reiserfs/hashes.c	2003-07-13 06:04:57.000000000 +0100
@@ -90,10 +90,6 @@ u32 keyed_hash(const signed char *msg, i
 
 	if (len >= 12)
 	{
-	    	//assert(len < 16);
-		if (len >= 16)
-		    BUG();
-
 		a = (u32)msg[ 0]      |
 		    (u32)msg[ 1] << 8 |
 		    (u32)msg[ 2] << 16|
@@ -116,9 +112,6 @@ u32 keyed_hash(const signed char *msg, i
 	}
 	else if (len >= 8)
 	{
-	    	//assert(len < 12);
-		if (len >= 12)
-		    BUG();
 		a = (u32)msg[ 0]      |
 		    (u32)msg[ 1] << 8 |
 		    (u32)msg[ 2] << 16|
@@ -137,9 +130,6 @@ u32 keyed_hash(const signed char *msg, i
 	}
 	else if (len >= 4)
 	{
-	    	//assert(len < 8);
-		if (len >= 8)
-		    BUG();
 		a = (u32)msg[ 0]      |
 		    (u32)msg[ 1] << 8 |
 		    (u32)msg[ 2] << 16|
@@ -154,9 +144,6 @@ u32 keyed_hash(const signed char *msg, i
 	}
 	else
 	{
-	    	//assert(len < 4);
-		if (len >= 4)
-		    BUG();
 		a = b = c = d = pad;
 		for(i = 0; i < len; i++)
 		{

^ permalink raw reply	[flat|nested] 7+ messages in thread
* Re: [PATCH] Remove useless assertions from reiserfs
@ 2003-08-11 18:33 Petr Vandrovec
  2003-08-11 18:46 ` Dave Jones
  0 siblings, 1 reply; 7+ messages in thread
From: Petr Vandrovec @ 2003-08-11 18:33 UTC (permalink / raw)
  To: Valdis.Kletnieks; +Cc: davej, torvalds, linux-kernel, jgarzik

On 11 Aug 03 at 14:00, Valdis.Kletnieks@vt.edu wrote:
> On Mon, 11 Aug 2003 13:45:30 EDT, Jeff Garzik said:
> > Why are these useless?
> 
> > >     if (len >= 12)
> > >     {          
> > >      //assert(len < 16);
> > >               if (len >= 16)
> > >                    BUG();
> > 
> > Seems like a valid check to me...
> 
> Just before that, there's code:
> 
>      while(len >= 16)
>         {
>     ...
>                 len -= 16;
>             }
> 
> So if that ever exits with a len >=16, we have a SERIOUS problem with
> either the compiler or the hardware - as such, that "if (..) BUG" is dead code.
> Similarly for the other checks.

I always thought that assertions are just for that - if you can hit them
without some unexpected event/bug, you have a SERIOUS problem.
                                                    Petr Vandrovec
                                                    


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

end of thread, other threads:[~2003-08-11 18:48 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-08-11 16:48 [PATCH] Remove useless assertions from reiserfs davej
2003-08-11 17:45 ` Jeff Garzik
2003-08-11 17:52   ` Dave Jones
2003-08-11 17:56     ` Jeff Garzik
2003-08-11 18:00   ` Valdis.Kletnieks
  -- strict thread matches above, loose matches on Subject: below --
2003-08-11 18:33 Petr Vandrovec
2003-08-11 18:46 ` Dave Jones

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox