Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3567140pxb; Mon, 24 Jan 2022 12:23:21 -0800 (PST) X-Google-Smtp-Source: ABdhPJyI8VC3hz3mDrBmz5yXVa2L9FYdBRmUXtTW55RZaWdcythN25+3Rua/wZHfFShP+ujbKPQe X-Received: by 2002:a17:90b:4ac5:: with SMTP id mh5mr18847pjb.197.1643055801216; Mon, 24 Jan 2022 12:23:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643055801; cv=none; d=google.com; s=arc-20160816; b=uWowVJbPe08Bo9LfrEoUT2c3b2wXy+YRSFaz2mQuWAUdhiHnA1XHzUij+8BcH0D1A+ huhbeiP4Wk1JeCH6CGJtvr4vMeB0dzDFMjDLsi1g1QcyqEbex2n92BGwaPqkg5nMCfmo qcI2Qtt6a2aoQ4ldqwnbqahyA62kqtTHFcOKYwfuR+ICDGbBFOsV1UIhyAPX5riYh5GN 1YuCrzEiTTbtP4KKrCQZqnrwigiQsK2XrA0U0uAWxYWIGC1/uw2tFoi1K3HixsuZ4Er8 5RRJH8cbusP82BcuDyROpeTbwdNXC4h/0Vr+yOo1VCqOlZQejcKw8sdxYl//DD9r2BTr lrsg== 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=iSFtP1QE2kQRgHaCl/ONNuH+Yqd7Ns4UPE4of1tLy98=; b=kZ9O4XqJP/9B98FqgpOiF/mWdR5XAt2etC33DdYW/RCRx/RzpLc5YRqHQPmlCCPQbF RO5VGXDYUdWG3TT2nZBWIiCS9Yw4cQTtAoS/+Lbf0YrCNZ1ZZYDPOzd/Kw4Z3m3iLUSo m+1I0sGCx/9wqelYhXJrgb2dj/uQBbWRKcOD76ma793fHUw+SR4x6SeSbIo5x7RQwl0c TwROwVo5buwuv8nFFRg07hzYdxZLSJaUMI7hqF18SINd1mQusHWLWsoYVCa4GtZ8JPft KLuZ8Sv3yuxpzsDKb+0fqpkBsVLuAwHb5NpKARfKsWCECjrHSoA13Adt8QfXe+IkoC/X 8ubw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=AC1ZE13s; 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 h8si14911379pgj.757.2022.01.24.12.23.07; Mon, 24 Jan 2022 12:23:21 -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=AC1ZE13s; 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 S1351809AbiAXT2q (ORCPT + 99 others); Mon, 24 Jan 2022 14:28:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48862 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348589AbiAXTTC (ORCPT ); Mon, 24 Jan 2022 14:19:02 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E4312C094273; Mon, 24 Jan 2022 11:07:27 -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 ams.source.kernel.org (Postfix) with ESMTPS id 65E5FB811FC; Mon, 24 Jan 2022 19:07:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8B772C340E5; Mon, 24 Jan 2022 19:07:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643051245; bh=poL+zK5nwsxWR6WXUiJrFUmGFdQojIuXmkSniBCjjfQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AC1ZE13sdbR4jtI3moW6mR4NwRskMG+sLKqo9K1syq4ipbPykyQJsBic1wr6FQUqY s45gy05+ndjyMDYApGWVxrdy8qc9i6vOzxHqWKYQ6V/3QM8FldbGC+DvLsWTOyk1Er ZS6HpbfliTNq1/mnmDCH/WxeRP1RSTBuvx4eer+Y= 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 4.14 073/186] powerpc/prom_init: Fix improper check of prom_getprop() Date: Mon, 24 Jan 2022 19:42:28 +0100 Message-Id: <20220124183939.472239817@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183937.101330125@linuxfoundation.org> References: <20220124183937.101330125@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 f8782c7ef50f1..7f049a60747e9 100644 --- a/arch/powerpc/kernel/prom_init.c +++ b/arch/powerpc/kernel/prom_init.c @@ -2774,7 +2774,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