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 X-Spam-Level: X-Spam-Status: No, score=-8.9 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2D490C04A6B for ; Mon, 6 May 2019 21:25:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E8D3B2087F for ; Mon, 6 May 2019 21:25:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726755AbfEFVZn (ORCPT ); Mon, 6 May 2019 17:25:43 -0400 Received: from smtp-out.xnet.cz ([178.217.244.18]:38323 "EHLO smtp-out.xnet.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726118AbfEFVZl (ORCPT ); Mon, 6 May 2019 17:25:41 -0400 Received: from meh.true.cz (meh.true.cz [108.61.167.218]) (Authenticated sender: petr@true.cz) by smtp-out.xnet.cz (Postfix) with ESMTPSA id 2D96E50A5; Mon, 6 May 2019 23:25:39 +0200 (CEST) Received: by meh.true.cz (OpenSMTPD) with ESMTP id 2bdbf77d; Mon, 6 May 2019 23:25:38 +0200 (CEST) From: =?UTF-8?q?Petr=20=C5=A0tetiar?= To: netdev@vger.kernel.org, "David S. Miller" , Greg Kroah-Hartman Cc: Andrew Lunn , Florian Fainelli , Heiner Kallweit , Frank Rowand , devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, Maxime Ripard , =?UTF-8?q?Petr=20=C5=A0tetiar?= Subject: [PATCH net-next v2 3/4] staging: octeon-ethernet: Fix of_get_mac_address ERR_PTR check Date: Mon, 6 May 2019 23:24:46 +0200 Message-Id: <1557177887-30446-4-git-send-email-ynezz@true.cz> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1557177887-30446-1-git-send-email-ynezz@true.cz> References: <1557177887-30446-1-git-send-email-ynezz@true.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit 284eb160681c ("staging: octeon-ethernet: support of_get_mac_address new ERR_PTR error") has introduced checking for ERR_PTR encoded error value from of_get_mac_address with IS_ERR macro, which is not sufficient in this case, as the mac variable is set to NULL initialy and if the kernel is compiled without DT support this NULL would get passed to IS_ERR, which would lead to the wrong decision and would pass that NULL pointer and invalid MAC address further. Fixes: 284eb160681c ("staging: octeon-ethernet: support of_get_mac_address new ERR_PTR error") Signed-off-by: Petr Štetiar --- drivers/staging/octeon/ethernet.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/octeon/ethernet.c b/drivers/staging/octeon/ethernet.c index 2b03018..8847a11c2 100644 --- a/drivers/staging/octeon/ethernet.c +++ b/drivers/staging/octeon/ethernet.c @@ -421,7 +421,7 @@ int cvm_oct_common_init(struct net_device *dev) if (priv->of_node) mac = of_get_mac_address(priv->of_node); - if (!IS_ERR(mac)) + if (!IS_ERR_OR_NULL(mac)) ether_addr_copy(dev->dev_addr, mac); else eth_hw_addr_random(dev); -- 1.9.1