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.8 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_PASS,USER_AGENT_NEOMUTT 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 8B1AAC43381 for ; Tue, 26 Feb 2019 08:43:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2C84E2147C for ; Tue, 26 Feb 2019 08:43:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b="EcS5pa+n" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726988AbfBZInX (ORCPT ); Tue, 26 Feb 2019 03:43:23 -0500 Received: from pandora.armlinux.org.uk ([78.32.30.218]:40248 "EHLO pandora.armlinux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725879AbfBZInW (ORCPT ); Tue, 26 Feb 2019 03:43:22 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=uqMvaEySOonkXtTea71s0ZDYZUEcqAh0pofI2irdiQo=; b=EcS5pa+ne8lgaaXuCsmZBaAZn kMfWSYvLhO9ai/aa6A7UJtZDkgcNSDHn+2sB7QzyM5bTtB2PZodZnNoi+wJERq7BN/RF2yngZEE66 po4s5705vhQ/fXW75o9aPigR7ySiqAMBrWeTU/3CcSXIOkI6zR8fRhgRJcgK/O53WflcCqr6JMfh4 oVduRHePvW443AFe21iNyj1uOTN0rz43d1HVDu9TSdQywe+/ka3JoVisJVp3pf1H6epb3Hx99aLrk Xm+NpgBeqH/1N4YRx4asik5xx10gh/jRVsqFmtpUZiMys/u1ibbyui/xQvFuh0X5o060MpHzmZGEP +Z9OCkkgQ==; Received: from shell.armlinux.org.uk ([2001:4d48:ad52:3201:5054:ff:fe00:4ec]:54784) by pandora.armlinux.org.uk with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from ) id 1gyYKa-0002OF-Qx; Tue, 26 Feb 2019 08:43:16 +0000 Received: from linux by shell.armlinux.org.uk with local (Exim 4.89) (envelope-from ) id 1gyYKX-0005YL-Bi; Tue, 26 Feb 2019 08:43:13 +0000 Date: Tue, 26 Feb 2019 08:43:13 +0000 From: Russell King - ARM Linux admin To: Heiner Kallweit Cc: David Miller , Andrew Lunn , Florian Fainelli , "netdev@vger.kernel.org" Subject: Re: [PATCH v2 net] net: phy: phylink: fix uninitialized variable in phylink_get_mac_state Message-ID: <20190226084313.v3uhd6yjmovzz24j@shell.armlinux.org.uk> References: <6c710eec-a299-5239-dde1-097209e8868d@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6c710eec-a299-5239-dde1-097209e8868d@gmail.com> User-Agent: NeoMutt/20170113 (1.7.2) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Tue, Feb 26, 2019 at 08:25:41AM +0100, Heiner Kallweit wrote: > When debugging an issue I found implausible values in state->pause. > Reason in that state->pause isn't initialized and later only single > bits are changed. Also the struct itself isn't initialized in > phylink_resolve(). So better initialize state->pause. mac_link_state() is expected to always set this, but this is safer. Maybe also set state->speed to SPEED_UNKNOWN, state->duplex to DUPLEX_UNKNOWN and state->an_complete to zero? > > v2: > - use right function name in subject > > Fixes: 9525ae83959b ("phylink: add phylink infrastructure") > Signed-off-by: Heiner Kallweit > --- > drivers/net/phy/phylink.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c > index 59d175a5b..a9954c205 100644 > --- a/drivers/net/phy/phylink.c > +++ b/drivers/net/phy/phylink.c > @@ -324,6 +324,7 @@ static int phylink_get_mac_state(struct phylink *pl, struct phylink_link_state * > linkmode_zero(state->lp_advertising); > state->interface = pl->link_config.interface; > state->an_enabled = pl->link_config.an_enabled; > + state->pause = MLO_PAUSE_NONE; > state->link = 1; > > return pl->ops->mac_link_state(ndev, state); > -- > 2.20.1 > > -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTC broadband for 0.8mile line in suburbia: sync at 12.1Mbps down 622kbps up According to speedtest.net: 11.9Mbps down 500kbps up