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] [thread-next>] [day] [month] [year] [list]
Message-ID: <20101108221528.GH6273@lenovo>
Date:	Tue, 9 Nov 2010 01:15:29 +0300
From:	Cyrill Gorcunov <gorcunov@...il.com>
To:	Andi Kleen <andi@...stfloor.org>
Cc:	Thomas Gleixner <tglx@...utronix.de>, akpm@...ux-foundation.org,
	linux-kernel@...r.kernel.org, Andi Kleen <ak@...ux.intel.com>,
	x86@...nel.org
Subject: Re: [PATCH] x86: fix apic.h unused but set warnings v2

On Mon, Nov 08, 2010 at 10:57:30PM +0100, Andi Kleen wrote:
> Thomas Gleixner <tglx@...utronix.de> writes:
> 
> > On Mon, 8 Nov 2010, Andi Kleen wrote:
> >>  static inline u32 native_apic_msr_read(u32 reg)
> >>  {
> >> -	u32 low, high;
> >> +	u32 low;
> >>  
> >>  	if (reg == APIC_DFR)
> >>  		return -1;
> >>  
> >> -	rdmsr(APIC_BASE_MSR + (reg >> 4), low, high);
> >> -	return low;
> >> +	rdmsrl(APIC_BASE_MSR + (reg >> 4), low);
> >> +	return (u32)low;
> >
> > What's the point of casting u32 to u32 ?
> 
> One of the earlier reviewers thought adding an explicit cast would make
> the truncation in the code clearer.  I didn't full agree either, but 
> still did the change.
> 
> -Andi

Well, Andi I proposed to define variable as u64 and convert it back to u32 at procedure
exit point. That would be clean, and I still think so ;) Though I'm fine with
either way (I just thought about ones who will be reading this code in future,
and since most the rdmsrl callers already use u64 and unsigned long, this would
be consistent as well).

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