From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Google-Smtp-Source: AH8x225clVkQSQ0qCA/kxzoPGIKNcE0VaFHjaDgJmtPIZAdT6nYsz8/UnAEKX0jWYvxWK+3p+DQD ARC-Seal: i=1; a=rsa-sha256; t=1517256792; cv=none; d=google.com; s=arc-20160816; b=MJ03aGbtUVw7LFkWfzYq7K47gz0Ua2zjzhtjwdT0KJ70qwXEEDWAqZYTyvRXiHwTCS a1EEq+hwdGjFjTjm6G2BZmRR1WxH67zwvojBY8tj9HEhDf5wtMz0wLBQWcFOLYwhLN+Y f07vn5fxu9OkTPvr+PtJx/y01yGY7TWTxnFS7wlcZlAL2vh23/JRxjkSTusN4Iz5uJoO V+V4YDcG7azOJRLr1d4t6qyvxwXgx3F+awwJXUnLgWtOR62tE3avpZphpowXM6D7uD7i SOKGqytjHa6+uGIVoheWyQU9LX8KochQs3sgbOQUimCYhSwD/sDezVP6WrUVPX3OYrKA W2AQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:user-agent:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=BCTNDZM9qgLeVyb6tM8CwaYV3NLYh7g998N9Btq+fYQ=; b=sp6p/QMSMTE1zlq+zTCaqGuT2gjOsqP0aecUS309VoJbQ0rn6Mf+ODtFNsk2ZWWIHy OvXSumqz7X8GkKi42Z/KxatzqZWy2b+8m+2VsKIFSTT3cZvT5RK8rR6QKnPD/iHNPMw2 uX+oZtorFqPGyrZA96Irc1vTgPivcUAomplrW7Kj6uy5hNPTFH/0Ac9pL7BxgaZM+T2n ijJVbc57XE4ngfxBLm4C0eytnmcmbzRPS/KK9MuTV5em/I7muJ6EEc/2C8JK9QWH3PYb wcVo/NdxG2J1fEu3JL7jUytHCzv9VwL20bWhkQRz9gI3Oy6AhEYwbq4Uyl3RFvPSKuU9 n/Dg== ARC-Authentication-Results: i=1; mx.google.com; spf=softfail (google.com: domain of transitioning gregkh@linuxfoundation.org does not designate 90.92.71.90 as permitted sender) smtp.mailfrom=gregkh@linuxfoundation.org Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning gregkh@linuxfoundation.org does not designate 90.92.71.90 as permitted sender) smtp.mailfrom=gregkh@linuxfoundation.org From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Helmut Grauer , Talat Batheesh , Saeed Mahameed , "David S. Miller" Subject: [PATCH 4.14 51/71] net/mlx5e: Fix fixpoint divide exception in mlx5e_am_stats_compare Date: Mon, 29 Jan 2018 13:57:19 +0100 Message-Id: <20180129123830.835568233@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180129123827.271171825@linuxfoundation.org> References: <20180129123827.271171825@linuxfoundation.org> User-Agent: quilt/0.65 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-LABELS: =?utf-8?b?IlxcU2VudCI=?= X-GMAIL-THRID: =?utf-8?q?1590959058513552940?= X-GMAIL-MSGID: =?utf-8?q?1590959058513552940?= X-Mailing-List: linux-kernel@vger.kernel.org List-ID: 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Talat Batheesh [ Upstream commit e58edaa4863583b54409444f11b4f80dff0af1cd ] Helmut reported a bug about division by zero while running traffic and doing physical cable pull test. When the cable unplugged the ppms become zero, so when dividing the current ppms by the previous ppms in the next dim iteration there is division by zero. This patch prevent this division for both ppms and epms. Fixes: c3164d2fc48f ("net/mlx5e: Added BW check for DIM decision mechanism") Reported-by: Helmut Grauer Signed-off-by: Talat Batheesh Signed-off-by: Saeed Mahameed Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/mellanox/mlx5/core/en_rx_am.c | 6 ++++++ 1 file changed, 6 insertions(+) --- a/drivers/net/ethernet/mellanox/mlx5/core/en_rx_am.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rx_am.c @@ -197,9 +197,15 @@ static int mlx5e_am_stats_compare(struct return (curr->bpms > prev->bpms) ? MLX5E_AM_STATS_BETTER : MLX5E_AM_STATS_WORSE; + if (!prev->ppms) + return curr->ppms ? MLX5E_AM_STATS_BETTER : + MLX5E_AM_STATS_SAME; + if (IS_SIGNIFICANT_DIFF(curr->ppms, prev->ppms)) return (curr->ppms > prev->ppms) ? MLX5E_AM_STATS_BETTER : MLX5E_AM_STATS_WORSE; + if (!prev->epms) + return MLX5E_AM_STATS_SAME; if (IS_SIGNIFICANT_DIFF(curr->epms, prev->epms)) return (curr->epms < prev->epms) ? MLX5E_AM_STATS_BETTER :