From patchwork Mon Mar 10 20:50:59 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Hesselbarth X-Patchwork-Id: 3806571 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id B2DA5BF540 for ; Mon, 10 Mar 2014 20:51:46 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AAAF62021C for ; Mon, 10 Mar 2014 20:51:45 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B404520213 for ; Mon, 10 Mar 2014 20:51:44 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WN7Ag-00045O-UM; Mon, 10 Mar 2014 20:51:39 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WN7Ad-0004Km-JN; Mon, 10 Mar 2014 20:51:35 +0000 Received: from mail-ee0-x22c.google.com ([2a00:1450:4013:c00::22c]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WN7AZ-0004Ir-To for linux-arm-kernel@lists.infradead.org; Mon, 10 Mar 2014 20:51:32 +0000 Received: by mail-ee0-f44.google.com with SMTP id e49so3371489eek.3 for ; Mon, 10 Mar 2014 13:51:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=xtE5gJukZL26+iCBk/2Ytw9T6PBtZHghQeJpA3u5Xxk=; b=e1Lt3ZK4fWkMlERxTksHs4hBGPKI3mt/IJBUtsLG5rGC8U6R4U9KD+oMIaO7qkseY2 kc2mq02TwsCUWcy0yTmoHHVjUmnYXsTCGB0sDGv+LvFcXRvqKllwne4Wo8pUcHt8ghCr ew99Hxs/tOI5tVodMRMMo1QpnSbQnvCIArMSD3b+X66lo3FzedEpWvymQcelQRMluXmU f8CG2xX+Jwc9cOSvQ9NKK4Z/Bb4QR3Z+hjH53QFZNOPdsZzF5cmrix/Kqw4VJEldcU3R Ylt/wHJ+INaSGhGyiDrd3QN8uo6UwsY5B518pZqKxCw8VPh5x0RfZzpU6H4VZ/7qV0vN yPYA== X-Received: by 10.14.6.195 with SMTP id 43mr5141815een.101.1394484669470; Mon, 10 Mar 2014 13:51:09 -0700 (PDT) Received: from topkick.lan (dslc-082-083-251-183.pools.arcor-ip.net. [82.83.251.183]) by mx.google.com with ESMTPSA id m42sm49162131eex.21.2014.03.10.13.51.07 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Mar 2014 13:51:08 -0700 (PDT) From: Sebastian Hesselbarth To: Sebastian Hesselbarth Subject: [PATCH v2 1/3] net: phy: fix uninitalized WOL parameters in phy_ethtool_get_wol Date: Mon, 10 Mar 2014 21:50:59 +0100 Message-Id: <1394484661-4554-2-git-send-email-sebastian.hesselbarth@gmail.com> In-Reply-To: <1394484661-4554-1-git-send-email-sebastian.hesselbarth@gmail.com> References: <1394413270-7169-1-git-send-email-sebastian.hesselbarth@gmail.com> <1394484661-4554-1-git-send-email-sebastian.hesselbarth@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140310_165132_087052_07927D3D X-CRM114-Status: GOOD ( 11.45 ) X-Spam-Score: -2.0 (--) Cc: netdev@vger.kernel.org, Florian Fainelli , David Miller , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP phy_ethtool_get_wol is a helper to get current WOL settings from a phy device. When using this helper on a PHY without .get_wol callback, struct ethtool_wolinfo is never set-up correctly and may contain misleading information about WOL status. To fix this, always zero struct ethtool_wolinfo regardless of .get_wol callback availability. Signed-off-by: Sebastian Hesselbarth --- Changelog: v1->v2: - clear whole struct ethtool_wolinfo - check for non-NULL phy_device Cc: David Miller Cc: Florian Fainelli Cc: netdev@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org --- drivers/net/phy/phy.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index 19c9eca0ef26..dae1fa8aa23d 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -1092,7 +1092,9 @@ EXPORT_SYMBOL(phy_ethtool_set_wol); void phy_ethtool_get_wol(struct phy_device *phydev, struct ethtool_wolinfo *wol) { - if (phydev->drv->get_wol) + memset(wol, 0, sizeof(*wol)); + + if (phydev && phydev->drv->get_wol) phydev->drv->get_wol(phydev, wol); } EXPORT_SYMBOL(phy_ethtool_get_wol);