Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3707382pxb; Mon, 24 Jan 2022 15:57:48 -0800 (PST) X-Google-Smtp-Source: ABdhPJyvyf+SrUkSx+L2zBr911kvo1fFuWgvQrbYbr6cXcplTEK3MdO+3lkRF13Rnr+sXWsi2B71 X-Received: by 2002:a17:902:d50c:b0:14a:fcde:b3b2 with SMTP id b12-20020a170902d50c00b0014afcdeb3b2mr16160767plg.87.1643068668428; Mon, 24 Jan 2022 15:57:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643068668; cv=none; d=google.com; s=arc-20160816; b=cIrExPzsyVinv5Bckkb2jjWlBn9MENtE30cNevZd0mysf/GV3XIDVnjAQAuhG+03HE qYUpCGDCgWyrR71QmMUJwlBVmJvMX40Xd08yqs7zFfadM6y/3Ei6Ezn9nn0HSI6eHnCO flOlN9Y7Kh4tiDxZXiaolaUPhR0ZxugwP5RNznI7A74LxAkc5z7aK6tUgiftetkpPgO+ v/31+iLuXjlAq6yoaComSbj9MyZt7LfmifPIOf9zDyhEHISEsWcvC9jYeDUxF0Oee1bs /PEICk5WoEwI0OeAZQVemDyF+rPBIx8s2XsqJD+PMLTU2J1O1wdrtP/YDTnP5XUKJ2z2 LHLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=z2qfO+2pxvlGpwgJfpVL/RmQfmJAiz9XDRrA7JUkG8A=; b=RlSogsIV9LkjoZ04hauFEu8LhPvdc+pkY2rCAPUzT3BPXgQQQZHLXjGxjkrc3Ew3qi EzEzt1DMiSplZN5XS5cO7imSVhkWhrtStMPeAdU1l/HSo90kJ2NxUIR17pFGprE5LzpJ Xr/M6eKnPpIj7dEs0BZ/aqoJg+RvkOP8J9e++Zl/C/diOV1TLNyr0SLQdOd8LoCJVW9u 8v9BZjtR9l3/aTQrNpeGDxBrmyaeVkF2A+lPD4sGgBdG16Vmd2HbC5+YI1AF43Wpvau2 lwdrjbEHDV0k9xjMllipp/bKd153sUNLbAIU25xPsg3/8LAasKzssk/FHzhWtblum1+b noIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=e0HQ4zjH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y12si13727569plp.111.2022.01.24.15.57.36; Mon, 24 Jan 2022 15:57:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=e0HQ4zjH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2365810AbiAXXvp (ORCPT + 99 others); Mon, 24 Jan 2022 18:51:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46716 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1843489AbiAXXED (ORCPT ); Mon, 24 Jan 2022 18:04:03 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8CAB4C06C5B7; Mon, 24 Jan 2022 13:15:52 -0800 (PST) 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 dfw.source.kernel.org (Postfix) with ESMTPS id 2BF5461484; Mon, 24 Jan 2022 21:15:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 003CBC340E4; Mon, 24 Jan 2022 21:15:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058951; bh=xPFcUW/VW0HIXO34nXQrqLM6dA/LfJbR16e5fxSkbvk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=e0HQ4zjHi2F3fDyLRc+C7ZGubUuWbWWrKvegXywrRXVivrCsrHaFw1m6n1qfPXv0I 034WTj3EoL/WJ1LnWSW4gaIc4AAdcpxhgsKg0FOSQjbC0kC/jGxJ+MiwlUPdRxj9kr 8elVp+3P8TupgIrynA0VJNDXg2Anf0PEmtGjM6p0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Peiwei Hu , Michael Ellerman , Sasha Levin Subject: [PATCH 5.16 0456/1039] powerpc/prom_init: Fix improper check of prom_getprop() Date: Mon, 24 Jan 2022 19:37:25 +0100 Message-Id: <20220124184140.623807965@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Peiwei Hu [ Upstream commit 869fb7e5aecbc163003f93f36dcc26d0554319f6 ] prom_getprop() can return PROM_ERROR. Binary operator can not identify it. Fixes: 94d2dde738a5 ("[POWERPC] Efika: prune fixups and make them more carefull") Signed-off-by: Peiwei Hu Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/tencent_BA28CC6897B7C95A92EB8C580B5D18589105@qq.com Signed-off-by: Sasha Levin --- arch/powerpc/kernel/prom_init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c index 18b04b08b9833..f845065c860e3 100644 --- a/arch/powerpc/kernel/prom_init.c +++ b/arch/powerpc/kernel/prom_init.c @@ -2991,7 +2991,7 @@ static void __init fixup_device_tree_efika_add_phy(void) /* Check if the phy-handle property exists - bail if it does */ rv = prom_getprop(node, "phy-handle", prop, sizeof(prop)); - if (!rv) + if (rv <= 0) return; /* -- 2.34.1