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 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 07919C433EF for ; Thu, 9 Dec 2021 09:11:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=aty9RK+l0HCtnGCxFQQcttcArmTigr6t82Ts6tMZ400=; b=tv7eEvB6X2tgZY 76EeIQT8SdoJ1a5Y2tQ0rq1cvB2uqEQr5gxqOruvcJ3hgHEd17tQW6lkR1p0MBI+e6NEbUr2OcPuH B/P8TuqakZT7W+itV0L9NbklYkYYVpJuZLnzRB4dH7FKKsyiMeB+t3xHL4Tk0CD/UsYFXUYf7WE/r MfD2sqq5k3ytHNBlGW0xzopEk8g5Fk2muGWxfESq/FNJq9zo8CsyG6ldq26cl3A0TwrsxnebkkACM C9wvqlCDopKer/gPfzsKi3U00MOdmJgXnmXvQc/frFlFspXbU6XsfUh85mgZZKuFvR+GCAEAYBsHD OXxqFDq1ILDE1Pc+BXlQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mvFQX-00FKwJ-Ji; Thu, 09 Dec 2021 09:09:22 +0000 Received: from ams.source.kernel.org ([2604:1380:4601:e00::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mvFPh-00FKiC-G0 for linux-arm-kernel@lists.infradead.org; Thu, 09 Dec 2021 09:08:31 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 014F2B81FA7; Thu, 9 Dec 2021 09:08:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AF42BC004DD; Thu, 9 Dec 2021 09:08:24 +0000 (UTC) Date: Thu, 9 Dec 2021 09:08:21 +0000 From: Catalin Marinas To: Lakshmi Ramasubramanian Cc: dan.carpenter@oracle.com, robh@kernel.org, will@kernel.org, kbuild@lists.01.org, lkp@intel.com, kbuild-all@lists.01.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, bauerman@linux.ibm.com, qiuguorui1@huawei.com Subject: Re: [PATCH] arm64: kexec: Fix missing error code 'ret' warning in load_other_segments() Message-ID: References: <20211209004522.91926-1-nramas@linux.microsoft.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20211209004522.91926-1-nramas@linux.microsoft.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211209_010829_708790_D117CA51 X-CRM114-Status: GOOD ( 21.22 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Dec 08, 2021 at 04:45:22PM -0800, Lakshmi Ramasubramanian wrote: > Since commit ac10be5cdbfa ("arm64: Use common > of_kexec_alloc_and_setup_fdt()"), smatch reports the following warning: > > arch/arm64/kernel/machine_kexec_file.c:152 load_other_segments() > warn: missing error code 'ret' > > Return code is not set to an error code in load_other_segments() when > of_kexec_alloc_and_setup_fdt() call returns a NULL dtb. This results > in status success (return code set to 0) being returned from > load_other_segments(). > > Set return code to -ENOMEM if of_kexec_alloc_and_setup_fdt() returns > NULL dtb. > > Signed-off-by: Lakshmi Ramasubramanian > Reported-by: kernel test robot > Reported-by: Dan Carpenter > Fixes: ac10be5cdbfa ("arm64: Use common of_kexec_alloc_and_setup_fdt()") > --- > Patch created in dt/next branch in git repo > https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git > > arch/arm64/kernel/machine_kexec_file.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/arch/arm64/kernel/machine_kexec_file.c b/arch/arm64/kernel/machine_kexec_file.c > index 63634b4d72c1..04d072885e64 100644 > --- a/arch/arm64/kernel/machine_kexec_file.c > +++ b/arch/arm64/kernel/machine_kexec_file.c > @@ -149,6 +149,7 @@ int load_other_segments(struct kimage *image, > initrd_len, cmdline, 0); > if (!dtb) { > pr_err("Preparing for new dtb failed\n"); > + ret = -ENOMEM; > goto out_err; > } Above the 'if' block we have: dtb = of_kexec_alloc_and_setup_fdt(image, initrd_load_addr, initrd_len, cmdline, 0); Looking at this function, it has several ways to fail, not just on allocation. However, we assume above that it's always -ENOMEM. We could do like powerpc and use -EINVAL as more likely than allocation failure or change of_kexec_alloc_and_setup_fdt() to return ERR_PTR() and we use that. The latter would be my preferred option, though it probably doesn't matter much. The second best would be -EINVAL. -- Catalin _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel