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:	Thu, 1 Mar 2007 22:35:28 +0900
From:	Paul Mundt <lethal@...ux-sh.org>
To:	Geert Uytterhoeven <geert@...ux-m68k.org>
Cc:	Ben Dooks <ben@...ff.org.uk>,
	Linux Frame Buffer Device Development 
	<linux-fbdev-devel@...ts.sourceforge.net>,
	Linux Kernel Development <linux-kernel@...r.kernel.org>
Subject: Re: [Linux-fbdev-devel] [PATCH] fb: sm501fb off-by-1 sysfs store

On Thu, Mar 01, 2007 at 02:25:55PM +0100, Geert Uytterhoeven wrote:
> On Thu, 1 Mar 2007, Paul Mundt wrote:
> > @@ -1074,9 +1074,9 @@ static ssize_t sm501fb_crtsrc_store(struct device *dev,
> >  	if (len < 1)
> >  		return -EINVAL;
> >  
> > -	if (strnicmp(buf, "crt", sizeof("crt")) == 0)
> > +	if (strnicmp(buf, "crt", 3) == 0)
> >  		head = HEAD_CRT;
> > -	else if (strnicmp(buf, "panel", sizeof("panel")) == 0)
> > +	else if (strnicmp(buf, "panel", 5) == 0)
> >  		head = HEAD_PANEL;
> >  	else
> >  		return -EINVAL;
> 
> What about using just `strlen("string")' instead? ISTR gcc optimizes this to a
> constant. Not that it matters that much, as the actual string won't be
> duplicated.
> 
I stuck with the constants since they were already referenced in the
function, and there are enough other places in the kernel where they're
used for these things. I didn't figure that 5 was a terribly high number
to count to, but if there's expected difficulty, strlen() is of course an
option.

Personally I find it less visually offensive with constants, but as long
as the end number is the same, I'm not too concerned with how we get
there. Feel free to change it if you wish.
-
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