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 2CCCBC43381 for ; Tue, 26 Feb 2019 18:29:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DDA022173C for ; Tue, 26 Feb 2019 18:29:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="CmWWimF9" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729028AbfBZS33 (ORCPT ); Tue, 26 Feb 2019 13:29:29 -0500 Received: from mail-wm1-f65.google.com ([209.85.128.65]:33676 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728814AbfBZS33 (ORCPT ); Tue, 26 Feb 2019 13:29:29 -0500 Received: by mail-wm1-f65.google.com with SMTP id c13so2736994wmb.0 for ; Tue, 26 Feb 2019 10:29:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:subject:to:cc:message-id:date:user-agent:mime-version :content-language:content-transfer-encoding; bh=wmyK1N5gcRFZ2q99hl5jFe4vZuPUfWbYxDRNNlD8Fj0=; b=CmWWimF95QkA1SQLE4EbzIimAjehBMJd0LfNhLuInhSehAZ7Ivp9fpeRYl7SL9QyH2 uUJ15xt0QEmsSPeULiaO5s6d2cs+qmKjegiZsbnKnels1gMLTpGTupI4l7g7mOaDFjdW 1pdsYGS2/OrsBCIootIj4O6jEAS4PAxQjXUhYgjNpIKr9GhB7RI9vjFqKp91uGfNi8o+ oV95MJxRJPBXQVMlxywMa3MRo6Ba7yw4UB15Wch8jMAEhk0p27iYzA1fpibb3pYhOeRF zUt5DMLe7dJfg3FM9OvUqRy7u9Hy3qmUlu/pIt3shCOcqV5izli4v5sQKVhdwpOu2GxZ 1n+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:subject:to:cc:message-id:date:user-agent :mime-version:content-language:content-transfer-encoding; bh=wmyK1N5gcRFZ2q99hl5jFe4vZuPUfWbYxDRNNlD8Fj0=; b=Shbf46b6LHq1O8f5Tf28sIj2LBJMo6Di1ODMHNzBnJdtmOq+BETj7Cqx1vbT/atcVB Wwslrr9K0b0+FBm6NR+fgA+9zMm3pWSnenbd4EEzUjbKRLHWi8E1uZMeWs8aTY4FMPzm 0c/SttRFxRDG4tI3DwcG+K2MIRQfUvLRsZNNcNu4u5802aCkjgZaN0g0vSpxtlhdJdM4 TEKMTouUuEkTn3FVj25y9rAsYHSFFlscBrzyLLt4I5lkuCmz2ZbUpf7C6q6Hm515bhPT 0Egs2i4q6RX9/0gmU0kp98JT32fjpE0PswH8usIdhhNJKskPIJTvSOZrurg2gH8yqOmE 5fCg== X-Gm-Message-State: AHQUAubwMHoKKZOa5EHsosUmmbsuyYlKuCZaxvk5QiQe30VYqJgT6Ioc CcfUQMKsKnyZxENf2QrJsLSmYV7x X-Google-Smtp-Source: AHgI3IY9uN8cG1ulQ1qthdv9wD6FwHZDXP/b16pV5LxoW381xp9hYkDAz+8HUmaTDPJpbZ6RI3Fd0A== X-Received: by 2002:a1c:230e:: with SMTP id j14mr3723398wmj.9.1551205766495; Tue, 26 Feb 2019 10:29:26 -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 m26sm284246wmg.13.2019.02.26.10.29.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Feb 2019 10:29:25 -0800 (PST) From: Heiner Kallweit Subject: [PATCH v3 net] net: phy: phylink: fix uninitialized variable in phylink_get_mac_state To: Russell King - ARM Linux , David Miller , Andrew Lunn , Florian Fainelli Cc: "netdev@vger.kernel.org" Message-ID: <49e5b548-b82e-a975-20e4-051c0c634a6c@gmail.com> Date: Tue, 26 Feb 2019 19:29:22 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.5.1 MIME-Version: 1.0 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 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 and other not yet initialized fields. v2: - use right function name in subject v3: - initialize additional fields Fixes: 9525ae83959b ("phylink: add phylink infrastructure") Signed-off-by: Heiner Kallweit --- drivers/net/phy/phylink.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c index 59d175a5b..89750c7df 100644 --- a/drivers/net/phy/phylink.c +++ b/drivers/net/phy/phylink.c @@ -324,6 +324,10 @@ 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->speed = SPEED_UNKNOWN; + state->duplex = DUPLEX_UNKNOWN; + state->pause = MLO_PAUSE_NONE; + state->an_complete = 0; state->link = 1; return pl->ops->mac_link_state(ndev, state); -- 2.20.1