Re: [PATCH v2 2/2] hugetlb: Provide safer dummy values for HPAGE_MASKand HPAGE_SIZE

From: David Daney
Date: Fri Nov 18 2011 - 12:14:21 EST


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

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@xxxxxxxxxx>
Signed-off-by: David Daney<david.daney@xxxxxxxxxx>

WBR, Sergei



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/