From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 505FDC433E0 for ; Fri, 26 Mar 2021 13:58:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1A6DB61A21 for ; Fri, 26 Mar 2021 13:58:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230095AbhCZN6L (ORCPT ); Fri, 26 Mar 2021 09:58:11 -0400 Received: from mail.kernel.org ([198.145.29.99]:42334 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229848AbhCZN5s (ORCPT ); Fri, 26 Mar 2021 09:57:48 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 5EAB061A1E; Fri, 26 Mar 2021 13:57:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1616767068; bh=CtPkKxNXAFOwDCyjqkdra5XFgYEFZjQ87hGk/XR8cfo=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=LQbYXY0c66QiMRrNvdZD63b1ht8Cg7a1Z6oSZ2sYH8mvYJMNwz/d+6SIcm5MI77Fi px+MXJVa4Tvdh9XQkhQsQ6PcK68ng/llZ9i9KvJjDCWW8XI0T2sPzW9NKKhy4Ljto/ nEXy3+302+i5kWYGI2TtU077PtOvW+4r1HQwewYA3SwFzJ/7Oa5PiIkAvIs3X/iig5 ZheDHM4an6hL3auItM+6TtxDEHAqU1JeJSeG0uRLELiinG4EfsfQczXFCG9WxkyTyp OFZNhap9iqoRQ4N+snOi0s+/qjXaIdCURf8xdVCEGmeHyB92YyIl9O3hK8T04ZeIRo kV5eNr29RGJ7A== Received: by mail-ot1-f41.google.com with SMTP id h6-20020a0568300346b02901b71a850ab4so5271016ote.6; Fri, 26 Mar 2021 06:57:48 -0700 (PDT) X-Gm-Message-State: AOAM533RH0UmBLCjfgDiwzzVVtKjtYTR/pbL3H4jzF2Jo8V4svkbIS1t CmJAeS89MN7/mwOVzQlBTmpgObAINVER66YzilQ= X-Google-Smtp-Source: ABdhPJw2W8ndU6vqWokiypCezNCBVaB+LIzgUdu9+pe2C79c/8Ebz3uTRhswUlzp6ZAR2fRYkvk0P6o+nTuGa+542AI= X-Received: by 2002:a9d:600a:: with SMTP id h10mr11317876otj.90.1616767067400; Fri, 26 Mar 2021 06:57:47 -0700 (PDT) MIME-Version: 1.0 References: <20210324145435.19753-1-changbin.du@gmail.com> In-Reply-To: <20210324145435.19753-1-changbin.du@gmail.com> From: Ard Biesheuvel Date: Fri, 26 Mar 2021 14:57:36 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] efi/fdt: fix panic when no valid fdt found To: Changbin Du Cc: linux-efi , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 24 Mar 2021 at 15:54, Changbin Du wrote: > > setup_arch() would invoke efi_init()->efi_get_fdt_params(). If no > valid fdt found then initial_boot_params will be null. So we > should stop further fdt processing here. I encountered this > issue on risc-v. > > Signed-off-by: Changbin Du I'll queue this up, thanks. > --- > drivers/firmware/efi/fdtparams.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/drivers/firmware/efi/fdtparams.c b/drivers/firmware/efi/fdtparams.c > index bb042ab7c2be..e901f8564ca0 100644 > --- a/drivers/firmware/efi/fdtparams.c > +++ b/drivers/firmware/efi/fdtparams.c > @@ -98,6 +98,9 @@ u64 __init efi_get_fdt_params(struct efi_memory_map_data *mm) > BUILD_BUG_ON(ARRAY_SIZE(target) != ARRAY_SIZE(name)); > BUILD_BUG_ON(ARRAY_SIZE(target) != ARRAY_SIZE(dt_params[0].params)); > > + if (!fdt) > + return 0; > + > for (i = 0; i < ARRAY_SIZE(dt_params); i++) { > node = fdt_path_offset(fdt, dt_params[i].path); > if (node < 0) > -- > 2.30.2 >