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: <alpine.LNX.2.00.0909120000010.31018@swampdragon.chaosbits.net>
Date:	Sat, 12 Sep 2009 00:07:49 +0200 (CEST)
From:	Jesper Juhl <jj@...osbits.net>
To:	Ingo Molnar <mingo@...e.hu>
cc:	Linus Torvalds <torvalds@...ux-foundation.org>,
	linux-kernel@...r.kernel.org, "H. Peter Anvin" <hpa@...or.com>,
	Thomas Gleixner <tglx@...utronix.de>,
	Jeremy Fitzhardinge <jeremy@...p.org>
Subject: Re: [GIT PULL] x86/xen for v2.6.32

On Fri, 11 Sep 2009, Ingo Molnar wrote:

[...]
> +static __init void xen_load_gdt_boot(const struct desc_ptr *dtr)
> +{
> +	unsigned long va = dtr->address;
> +	unsigned int size = dtr->size + 1;
> +	unsigned pages = (size + PAGE_SIZE - 1) / PAGE_SIZE;
> +	unsigned long frames[pages];
> +	int f;
> +
> +	/*
> +	 * A GDT can be up to 64k in size, which corresponds to 8192
> +	 * 8-byte entries, or 16 4k pages..
> +	 */
> +
> +	BUG_ON(size > 65536);
> +	BUG_ON(va & ~PAGE_MASK);
> +
> +	for (f = 0; va < dtr->address + size; va += PAGE_SIZE, f++) {
> +		pte_t pte;
> +		unsigned long pfn, mfn;
> +
> +		pfn = virt_to_pfn(va);
> +		mfn = pfn_to_mfn(pfn);
> +
> +		pte = pfn_pte(pfn, PAGE_KERNEL_RO);
> +
> +		if (HYPERVISOR_update_va_mapping((unsigned long)va, pte, 0))
> +			BUG();
[...]

Why is this cast of 'va' needed?  As far as I can see, 'va' already has 
the correct type of "unsigned long".
Pointless casts do more harm than good, let's remove this one :-)

Sorry that all I could comment on was this trivial thing, but I thought it 
better to comment than keep silent now that I had read the patch and 
spotted it...


-- 
Jesper Juhl <jj@...osbits.net>             http://www.chaosbits.net/
Plain text mails only, please      http://www.expita.com/nomime.html
Don't top-post  http://www.catb.org/~esr/jargon/html/T/top-post.html

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