From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757944AbcJQNsH (ORCPT ); Mon, 17 Oct 2016 09:48:07 -0400 Received: from mail-lf0-f53.google.com ([209.85.215.53]:33817 "EHLO mail-lf0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757515AbcJQNsA (ORCPT ); Mon, 17 Oct 2016 09:48:00 -0400 Subject: Re: [PATCH] MIPS: KASLR: Fix handling of NULL FDT To: Matt Redfearn , Ralf Baechle References: <1476698694-6685-1-git-send-email-matt.redfearn@imgtec.com> Cc: linux-mips@linux-mips.org, "# 4 . 7+" , linux-kernel@vger.kernel.org From: Sergei Shtylyov Organization: Cogent Embedded Message-ID: <02ddfa7e-62a5-8ef2-393f-cdd9b5f76bb8@cogentembedded.com> Date: Mon, 17 Oct 2016 16:47:55 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <1476698694-6685-1-git-send-email-matt.redfearn@imgtec.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello. On 10/17/2016 01:04 PM, Matt Redfearn wrote: > If platform code returns a NULL pointer to the FDT, initial_boot_params > will not get set to a valid pointer and attempting to find the /chosen > node in it will cause a NULL pointer dereference and the kernel to crash > immediately on startup - with no output to the console. > > Fix this by checking that initial_boot_params is valid before using it. > > Fixes: 405bc8fd12f5 ("MIPS: Kernel: Implement KASLR using CONFIG_RELOCATABLE") > Cc: # 4.7+ > Signed-off-by: Matt Redfearn > --- > > arch/mips/kernel/relocate.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/arch/mips/kernel/relocate.c b/arch/mips/kernel/relocate.c > index ca1cc30c0891..8810183840ca 100644 > --- a/arch/mips/kernel/relocate.c > +++ b/arch/mips/kernel/relocate.c > @@ -200,6 +200,7 @@ static inline __init unsigned long get_random_boot(void) > > #if defined(CONFIG_USE_OF) > /* Get any additional entropy passed in device tree */ > + if (initial_boot_params) > { CodingStyle: *if* and { should be on the same line. [...] MBR, Sergei