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=-7.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_PASS 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 45666C43381 for ; Tue, 26 Feb 2019 18:09:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0B3EA206B8 for ; Tue, 26 Feb 2019 18:09:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="dOESZIix" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728974AbfBZSJB (ORCPT ); Tue, 26 Feb 2019 13:09:01 -0500 Received: from mail-wm1-f66.google.com ([209.85.128.66]:34036 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727801AbfBZSJA (ORCPT ); Tue, 26 Feb 2019 13:09:00 -0500 Received: by mail-wm1-f66.google.com with SMTP id o10so2698347wmc.1 for ; Tue, 26 Feb 2019 10:08:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=lHldkkEsFLJavOdmE9okWG1qMj208SlOjCYgAvgpQJY=; b=dOESZIixsgSs+g0DZv/Ito4fb/1GYHV4j5hnkaxU0OwMoJDCsFsdwbW6YTJe3wDCMQ Hz6b1rsK5YhjCS/+kT6eO0iEpca7BB5lZdyUeM9iYmDx0Nxg/3qlR/vGZj/hivunQaK0 QyEfCBAfLZAykOcenWPWOmTjepaTdI5n+wkWavUreE8mReZPqyjQh7PMak0Tbcw71AQM 8Yz5vDzjwGLsX8WBLmuQngLz/udjrqg9k75EOf42GhFaSmKpTWUOJpF3LGzMLDbhpx85 oCl8heMPLMs9VKSNZfx1LijeiYMSN43ol3GlNa7UaffqaRoGK+CEQWznma+3hPaKEjJg iSrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=lHldkkEsFLJavOdmE9okWG1qMj208SlOjCYgAvgpQJY=; b=t7L15AbjJMj4XAbGHrNSGZZ3utAepOJbsci6ygteF20HCC5q6FdoOWqs6mJyWbvq+p Cz8P7VUtBVAz2a8ZII0fVx83ksSEKWtXupSG44etWupC4re3EJ0J5BorZib7H/ApXIUK WBcRkPM7PuTXoQRTOp73svUMjJmv/htLsyY6J0T5/mpzoi/czncjDAOngM3Ljw9RFW0p JlQWNc+MgkNGtt71L/7iJSR6n6uZ0afrwU+8Th0noW8qT2skrO+/3/8s8Qn81q+CnR1t IICBnUe3z9aTB+/M82ePybTG3Ex15J8toeqEhrV8WgMSJ92uUX9xVqiBtx/SpeWhq/Uy qOjQ== X-Gm-Message-State: AHQUAua+4D2nWbX0a9sTVmo2pmkLB9q5M2tMPybq9b4ReOGawR0PT7qy FJvA2nCZ8z8pJyl2iUNtmlPdPcqu X-Google-Smtp-Source: AHgI3IbkzhfHFNX2WfMybd/g8K6k1KWrQZjeK2FkQVPhP29vEMuP9yY7ctz0aepSN6A9DeXF+5Ew/A== X-Received: by 2002:a1c:be04:: with SMTP id o4mr3368985wmf.19.1551204537984; Tue, 26 Feb 2019 10:08:57 -0800 (PST) Received: from ?IPv6:2003:ea:8bf1:e200:e589:7fe7:4b99:1bfa? (p200300EA8BF1E200E5897FE74B991BFA.dip0.t-ipconnect.de. [2003:ea:8bf1:e200:e589:7fe7:4b99:1bfa]) by smtp.googlemail.com with ESMTPSA id g81sm194369wmf.7.2019.02.26.10.08.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Feb 2019 10:08:57 -0800 (PST) Subject: Re: [PATCH v2 net] net: phy: phylink: fix uninitialized variable in phylink_get_mac_state To: Russell King - ARM Linux admin Cc: David Miller , Andrew Lunn , Florian Fainelli , "netdev@vger.kernel.org" References: <6c710eec-a299-5239-dde1-097209e8868d@gmail.com> <20190226084313.v3uhd6yjmovzz24j@shell.armlinux.org.uk> From: Heiner Kallweit Message-ID: <75562085-542c-0cf0-d033-bbac688c5bb2@gmail.com> Date: Tue, 26 Feb 2019 19:08:50 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.5.1 MIME-Version: 1.0 In-Reply-To: <20190226084313.v3uhd6yjmovzz24j@shell.armlinux.org.uk> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On 26.02.2019 09:43, Russell King - ARM Linux admin wrote: > 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. > I've seen cases where mac_link_state() just initializes the relevant bits. Therefore there's no functional problem, but it's not nice (and disturbs in debug output) if all other bits have a random value. > Maybe also set state->speed to SPEED_UNKNOWN, state->duplex to > DUPLEX_UNKNOWN and state->an_complete to zero? > OK. Will include this in a v3. >> >> 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 >> >> >