From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6501D153836; Fri, 6 Dec 2024 15:05:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733497544; cv=none; b=G71v7USUip4AMJDllFmQeODR5Vb18ozA/cMRw+rsapMHJ687Us8EPE/x4DrU3o9aXpJElLXYXhtneo9fwnoANnW0UpPGw9vpgK6KMQxJDeHAigJQ92kZbyWw8MzhaPv0OyqYRXh6hkDtYeoQlkvZ202FxenPiAIl/6PzKMgRiuQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733497544; c=relaxed/simple; bh=INvuq8DfAta+mrhN2t1RomIhoOzH8pK/jrnKo5MQD3U=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Edm2smYaXInvacGcmzax9AMq/cczuEe4VeCZQDk2uoJUv7lvsb9mL5Vdc8v6kATB742/yx/Rza+LN1FC43UxUVutvE+Z2gcj1vvgf6Vef6f7M8AdsTUNVwTYiBzH1dkBVjfPtpzAwUZuz/litJC2UgqRa3jQL1floxfESEozRCo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=HH4rcGV4; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="HH4rcGV4" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D1181C4CED1; Fri, 6 Dec 2024 15:05:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1733497544; bh=INvuq8DfAta+mrhN2t1RomIhoOzH8pK/jrnKo5MQD3U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HH4rcGV4lCuqOj5Flir2M0JeQkLE5lxjiVBr+NpU0UoJL5EuY5FcmhIzuYhWafVV8 LqKYqCGHJcxjiP7cBnt0UhC4nj1uQMQmVKbeB/HJGrqpluJXJeY6JR+Akaou11lrvT MXXMbyTSFZgXF9srLQnLaQmq4LAQnD7flz0s/ZlI= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Zhang Zekun , Michael Ellerman , Sasha Levin Subject: [PATCH 6.6 322/676] powerpc/kexec: Fix return of uninitialized variable Date: Fri, 6 Dec 2024 15:32:21 +0100 Message-ID: <20241206143705.922174085@linuxfoundation.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241206143653.344873888@linuxfoundation.org> References: <20241206143653.344873888@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Zhang Zekun [ Upstream commit 83b5a407fbb73e6965adfb4bd0a803724bf87f96 ] of_property_read_u64() can fail and leave the variable uninitialized, which will then be used. Return error if reading the property failed. Fixes: 2e6bd221d96f ("powerpc/kexec_file: Enable early kernel OPAL calls") Signed-off-by: Zhang Zekun Signed-off-by: Michael Ellerman Link: https://patch.msgid.link/20240930075628.125138-1-zhangzekun11@huawei.com Signed-off-by: Sasha Levin --- arch/powerpc/kexec/file_load_64.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/kexec/file_load_64.c b/arch/powerpc/kexec/file_load_64.c index a3de5369d22c2..7b71737ae24cc 100644 --- a/arch/powerpc/kexec/file_load_64.c +++ b/arch/powerpc/kexec/file_load_64.c @@ -916,13 +916,18 @@ int setup_purgatory_ppc64(struct kimage *image, const void *slave_code, if (dn) { u64 val; - of_property_read_u64(dn, "opal-base-address", &val); + ret = of_property_read_u64(dn, "opal-base-address", &val); + if (ret) + goto out; + ret = kexec_purgatory_get_set_symbol(image, "opal_base", &val, sizeof(val), false); if (ret) goto out; - of_property_read_u64(dn, "opal-entry-address", &val); + ret = of_property_read_u64(dn, "opal-entry-address", &val); + if (ret) + goto out; ret = kexec_purgatory_get_set_symbol(image, "opal_entry", &val, sizeof(val), false); } -- 2.43.0