lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Wed, 3 Mar 2010 05:18:19 -0700
From:	Matthew Wilcox <matthew@....cx>
To:	Dan Carpenter <error27@...il.com>, Greg KH <greg@...ah.com>,
	tim@...erpafrica.com, gregkh@...e.de, devel@...verdev.osuosl.org,
	Tim Schofield <tim.schofield1960@...glemail.com>,
	linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: Re: verifying whitespace patches don't change anything was Re:
	[PATCH] Staging:rtl8192e: fix comments

On Wed, Mar 03, 2010 at 10:10:23AM +0300, Dan Carpenter wrote:
> On Thu, Feb 18, 2010 at 08:05:47AM -0800, Greg KH wrote:
> > On Tue, Feb 16, 2010 at 04:35:16PM +0000, tim@...erpafrica.com wrote:
> > > From: Tim Schofield <tim.schofield1960@...glemail.com>
> > > 
> > > ---
> > >  drivers/staging/rtl8192e/r8180_93cx6.c |   22 ++++++++++++++--------
> > >  1 files changed, 14 insertions(+), 8 deletions(-)
> > > 
> > > diff --git a/drivers/staging/rtl8192e/r8180_93cx6.c b/drivers/staging/rtl8192e/r8180_93cx6.c
> > > index 262ed5f..60fba80 100644
> > > --- a/drivers/staging/rtl8192e/r8180_93cx6.c
> > > +++ b/drivers/staging/rtl8192e/r8180_93cx6.c
> > > @@ -23,12 +23,14 @@
> > >  static void eprom_cs(struct net_device *dev, short bit)
> > >  {
> > >  	if (bit)
> > > +		/* enable EPROM */
> > >  		write_nic_byte(dev, EPROM_CMD,
> > >  			       (1<<EPROM_CS_SHIFT) | \
> > > -			       read_nic_byte(dev, EPROM_CMD)); //enable EPROM
> > > +			       read_nic_byte(dev, EPROM_CMD));
> > >  	else
> > > +		/* disable EPROM */
> > >  		write_nic_byte(dev, EPROM_CMD, read_nic_byte(dev, EPROM_CMD)\
> > > -			       &~(1<<EPROM_CS_SHIFT)); //disable EPROM
> > > +			       &~(1<<EPROM_CS_SHIFT));
> > 
> > This does not do what you think it does (hint, you need {} if you want
> > to have more than one line in an if statement...)

Sorry, Greg, you're wrong in this case.  /* */ does not count as a line.
Here's an example:

$ cat foo.c 
#include <stdio.h>

int main(void)
{
        if (0)
                /* foo */
                printf("Hello, World\n");
        return 0;
}

$ gcc -o foo foo.c -W -Wall -O2 -g
$ ./foo
[no output]


I think a much more cogent criticism of this patch would be that the comment
is entirely unnecessary for this function with a simple change:

-static void eprom_cs(struct net_device *dev, short bit)
+static void eprom_cs(struct net_device *dev, short enable)
 {
-	if (bit)
+	if (enable)
 		write_nic_byte(dev, EPROM_CMD,
 			       (1<<EPROM_CS_SHIFT) | \
-			       read_nic_byte(dev, EPROM_CMD)); //enable EPROM
+			       read_nic_byte(dev, EPROM_CMD));
 	else
 		write_nic_byte(dev, EPROM_CMD, read_nic_byte(dev, EPROM_CMD)\
-			       &~(1<<EPROM_CS_SHIFT)); //disable EPROM
+			       &~(1<<EPROM_CS_SHIFT));

-- 
Matthew Wilcox				Intel Open Source Technology Centre
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours.  We can't possibly take such
a retrograde step."
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ