Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2270887yba; Mon, 6 May 2019 03:02:08 -0700 (PDT) X-Google-Smtp-Source: APXvYqzHbePhFxMCzqyyOJir99JQJ4CDNT3i0UNS2h86swLnEGbVirir+knPXez8j/xZwYVsyMG+ X-Received: by 2002:a17:902:d892:: with SMTP id b18mr16024198plz.209.1557136928270; Mon, 06 May 2019 03:02:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557136928; cv=none; d=google.com; s=arc-20160816; b=R+ydJx46urMAl8R/GHwWvzqor5csHZhs8txyXiRVXr3QAVqZCQkaJ3dB5h4pUNnukK 12I3QWQp9x8ZfFtuazDEUAdS/KvEQ40wYMSkUIxwsLrB9vUNS5mGJixX/GIiF9EISkCK hFQJ2yi+PXIFZrl4yD/fXHGCyn07ybVtZyVD3SwyAAtQxhNOXGGaioP6SnhaTTcgNhBf 3JzMLOYkThIJjtbKeIpumqeuqQ7sfnZr8ErubneAVSUIhfUqeOoqGF3gZMW4JwUlNjpz 3rx2NPaWigt5Ukp1BClq11aPByaqMq42KZOFB3gv7JyZFxdKiIkAhpo1RDhOJ2QPmjUc DiBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=8DjfAt+TizfNrUyDWudQBwJxTeoK1qrRDCspnvS0EUg=; b=wdf8DhVbQhZOe3BvDKOJhaNI/6s8lLPb2T1vIsNMscHcR7+sObZwNoJDc00R5BWrXJ LVkfjJfMpHO8HuV3j7mn1HU3j8pdxcHCeU4adEPOBPcfgLkgf9wo8mJcV1KN0YaYtfoI RLKucIq2L9deFxU/lW30Pe5BCKm9BQrjMsIqqSROx6/+F/5cHtFGljBZOIpxBg5HACCV ZU8s0QPPpF1NVVqTX0g32Ln/Z68Pfr2OT0vI5n2KNgiWIUmMRHjOAJe9x2OwYIw/8GwK IoAh2QzY9PoZLmpvx8BoLYPiQ173Y6cqKs8Lnc/Dsd2cOHuz1QyscLYPimtQdjgmR1PE WEqA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v5si13184936pgr.121.2019.05.06.03.01.51; Mon, 06 May 2019 03:02:08 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726553AbfEFJ73 (ORCPT + 99 others); Mon, 6 May 2019 05:59:29 -0400 Received: from smtp-out.xnet.cz ([178.217.244.18]:36821 "EHLO smtp-out.xnet.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726411AbfEFJ71 (ORCPT ); Mon, 6 May 2019 05:59:27 -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 BB305385B; Mon, 6 May 2019 11:59:25 +0200 (CEST) Received: by meh.true.cz (OpenSMTPD) with ESMTP id 735f0d6f; Mon, 6 May 2019 11:59:24 +0200 (CEST) From: =?UTF-8?q?Petr=20=C5=A0tetiar?= To: "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 3/3] staging: octeon-ethernet: Fix of_get_mac_address ERR_PTR check Date: Mon, 6 May 2019 11:58:37 +0200 Message-Id: <1557136717-531-4-git-send-email-ynezz@true.cz> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1557136717-531-1-git-send-email-ynezz@true.cz> References: <1557136717-531-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