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:	Fri, 01 Feb 2008 16:40:15 -0800
From:	Harvey Harrison <harvey.harrison@...il.com>
To:	"H. Peter Anvin" <hpa@...or.com>
Cc:	Ingo Molnar <mingo@...e.hu>, Thomas Gleixner <tglx@...utronix.de>,
	LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] x86: sparse errors from string_32.h

On Fri, 2008-02-01 at 10:06 -0800, H. Peter Anvin wrote:
> Ingo Molnar wrote:
> > * Harvey Harrison <harvey.harrison@...il.com> wrote:
> > 
> >>  		case 1:
> >> -			*(unsigned char *)s = pattern;
> >> +			*(unsigned char *)s = pattern & 0xff;
> > 
> > i've applied your fix - but wouldnt it be cleaner to just cast the 
> > pattern variable to unsigned char instead?
> > 
> 
> Even better, since we're talking about fixed bytes, I suggest writing it as:
> 
> 	*(u8 *)s = (u8)pattern;
> 
> Much more compact and the intent is a little bit more obvious.
> 

While I agree that is cleaner, that will still produce sparse warnings
about a cast truncating bits from a constant value.  I think that
explicit & is necessary (unless the cure is worse than the disease).

Harvey

--
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