linux-mips
[Top] [All Lists]

Re: [PATCH v2 2/2] hugetlb: Provide safer dummy values for HPAGE_MASK an

To: Sergei Shtylyov <sshtylyov@mvista.com>, Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH v2 2/2] hugetlb: Provide safer dummy values for HPAGE_MASK and HPAGE_SIZE
From: David Daney <ddaney.cavm@gmail.com>
Date: Fri, 18 Nov 2011 09:14:17 -0800
Cc: linux-mips@linux-mips.org, ralf@linux-mips.org, linux-kernel@vger.kernel.org, David Daney <david.daney@cavium.com>
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=C4wsFfYEn13/ruHNhUKwGkPltcavw8TkzVDcw3e33tc=; b=PxZGKV67RXMXM8CEGsYB1B4DjkRyuw7NZsWQ9+AQP+6bN9hF2BzH0LqIpR0HZVmSGq Z2rHDnH10wci8R9O91LnJlO0nHYeB38VgJXpzuFnU1z+A13yNPJMNnvSfelJecxm2N2J 9QO48pa/PC3dgQcq3hqM3PxHspB4LHk2GYpqM=
In-reply-to: <4EC61DB1.3090608@mvista.com>
References: <1321567050-13197-1-git-send-email-ddaney.cavm@gmail.com> <1321567050-13197-3-git-send-email-ddaney.cavm@gmail.com> <4EC61DB1.3090608@mvista.com>
Sender: linux-mips-bounce@linux-mips.org
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.15) Gecko/20101027 Fedora/3.0.10-1.fc12 Thunderbird/3.0.10
On 11/18/2011 12:56 AM, Sergei Shtylyov wrote:
Hello.

On 18-11-2011 1:57, David Daney wrote:

From: David Daney<david.daney@cavium.com>

It was pointed out by David Rientjes that the dummy values for
HPAGE_MASK and HPAGE_SIZE are quite unsafe. It they are inadvertently
used with !CONFIG_HUGETLB_PAGE, compilation would succeed, but the
resulting code would surly not do anything sensible.

Place BUG() in the these dummy definitions, as we do in similar
circumstances in other places, so any abuse can be easily detected.

Since the only sane place to use these symbols when
!CONFIG_HUGETLB_PAGE is on dead code paths, the BUG() cause any actual
code to be emitted by the compiler.

You mean "doesn't cause"?

Yes.

I mentioned this in a different message to akpm, but I am not sure if I should resend the patch with a corrected change log.

David Daney


Cc: David Rientjes<rientjes@google.com>
Signed-off-by: David Daney<david.daney@cavium.com>

WBR, Sergei




<Prev in Thread] Current Thread [Next in Thread>