From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755791AbbCBO7Q (ORCPT ); Mon, 2 Mar 2015 09:59:16 -0500 Received: from mx1.redhat.com ([209.132.183.28]:47812 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755770AbbCBO7O (ORCPT ); Mon, 2 Mar 2015 09:59:14 -0500 From: Baoquan He To: hpa@zytor.com, yinghai@kernel.org, keescook@chromium.org, vgoyal@redhat.com, luto@amacapital.net, akpm@linux-foundation.org, tglx@linutronix.de, mingo@redhat.com Cc: linux-kernel@vger.kernel.org, Baoquan He Subject: [PATCH v2 2/9] a bug that relocation can not be handled when kernel is loaded above 2G Date: Mon, 2 Mar 2015 22:58:23 +0800 Message-Id: <1425308310-2318-3-git-send-email-bhe@redhat.com> In-Reply-To: <1425308310-2318-1-git-send-email-bhe@redhat.com> References: <1425308310-2318-1-git-send-email-bhe@redhat.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When process 32 bit relocation tables a local variable extended is defined to calculate the physical address of relocs entry. However it's type is int which is enough for i386, for x86_64 not enough. That's why relocation can only be handled when kernel is loaded below 2G, otherwise a overflow will happen and cause system hang. Here change it to long as 32 bit inverse relocation processing does, and this change is safe for i386 relocation handling too. Signed-off-by: Baoquan He --- arch/x86/boot/compressed/misc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/boot/compressed/misc.c b/arch/x86/boot/compressed/misc.c index 5903089..ac5c05e 100644 --- a/arch/x86/boot/compressed/misc.c +++ b/arch/x86/boot/compressed/misc.c @@ -278,7 +278,7 @@ static void handle_relocations(void *output, unsigned long output_len) * So we work backwards from the end of the decompressed image. */ for (reloc = output + output_len - sizeof(*reloc); *reloc; reloc--) { - int extended = *reloc; + long extended = *reloc; extended += map; ptr = (unsigned long)extended; -- 1.9.3