Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3556152pxb; Mon, 24 Jan 2022 12:08:21 -0800 (PST) X-Google-Smtp-Source: ABdhPJzRr3ZrAqE0+0aAhn7wJYcauP7/rUrzWhQSIbT8R79PmCzV9xhDMfcBxb9BGI1oZ5UprudT X-Received: by 2002:aa7:90c7:0:b0:4c9:1e96:d15c with SMTP id k7-20020aa790c7000000b004c91e96d15cmr5819436pfk.30.1643054900962; Mon, 24 Jan 2022 12:08:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643054900; cv=none; d=google.com; s=arc-20160816; b=hjw8oUOsBZzki8is5nMTRHvPq4FIlQmu+g+N9nidx6nEkqZirbQD7rtsbC59hNPdgd g5HYmplnhoNZiO/kfxNokciO3fDYH/fiLpsyCgxDsbg0b+oogU/4YEcyQFdYRgXMEInE sKKfSB062X59cwphQwcN+uhDDONyxKLBYVi//wU7s9/nMysl/e+K97LANzFnz/BBjNbQ ThBEfCpBgj/oFSW2kYPtRpDyaIahCsy2moJmbFXFJZrpEHFx0Ah+ykRIIR7UO+rRY9QU sFqJnCGhd020gFymWoCN9thLXwftmSZa4oqOj986Ifm//ISx7/en2JvY0pew4R3f67ss V30Q== 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=VxfRUew2kNX5B+MHt7lfELyEqwf/R4TD5SFKNw/65E8=; b=Tf9QrfEypm59QCRmWDk3h3/Gox/AQXqt6REx65ubhJOMMb1qpjwwVXBSZGZaeiu6qo WtJOO33y3LsNQTtOoG0NbpX7YjazmP+rQUc2c0CSBcbaJ93OjvTPomXH9mZWv7XVdNwr +DUiZTG2UVKAAtB0w9x+oxBQbSpHsaGYEXwQao3eizFCiipRiilW6/ZYw7AjPVTUNwHg 8JmQofBKAUdAD5IyHEh8XQe2Ic0iAfVZdDbmJhBV2rLz0SsaTs/ez/CpYGC25LDwrlmU 7XxvmbJyOewppkCGfSWTBkzBtwUBGOFVDmjLEtlN1hKI3eDX28MBZvYyEQp+bhG9Wtxb 4I6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=e57+BsUP; 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 t10si12336062pll.455.2022.01.24.12.08.05; Mon, 24 Jan 2022 12:08:20 -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=e57+BsUP; 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 S1345901AbiAXTEn (ORCPT + 99 others); Mon, 24 Jan 2022 14:04:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45346 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345323AbiAXTAD (ORCPT ); Mon, 24 Jan 2022 14:00:03 -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 07454C061787; Mon, 24 Jan 2022 10:57:08 -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 C2555B8121C; Mon, 24 Jan 2022 18:57:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F00CDC340E8; Mon, 24 Jan 2022 18:57:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643050625; bh=Qs0FuTYXs5t3/atNAdr+O7e+rOaKWpprhLBnwiJYbDY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=e57+BsUPrC1kZz33bIPd4AoiEgrFK84e07vuNcyXLECWtwq7EvcO75UNFE4cKdR2u vImhTrmSUpTJwNiAozvbH2TTyQ9M5U2PeHuGLnwM947d1qdVuC+Ekn6mgYE4QwHlcF MzXFkFXAzYuYGMpNCppodguiwEDBOAIK7qyGuE9Q= 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.9 061/157] powerpc/prom_init: Fix improper check of prom_getprop() Date: Mon, 24 Jan 2022 19:42:31 +0100 Message-Id: <20220124183934.721480975@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183932.787526760@linuxfoundation.org> References: <20220124183932.787526760@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 1e8c57207346e..df3af10b8cc95 100644 --- a/arch/powerpc/kernel/prom_init.c +++ b/arch/powerpc/kernel/prom_init.c @@ -2528,7 +2528,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