Blame SOURCES/0001-netdrv-linux-dim-Fix-overflow-in-dim-calculation.patch

f95c89
From 2bb4fd965ddb1682b18a937d61be197a242bc803 Mon Sep 17 00:00:00 2001
f95c89
From: Ivan Vecera <ivecera@redhat.com>
f95c89
Date: Wed, 7 Aug 2019 14:26:29 -0400
f95c89
Subject: [PATCH 01/96] [netdrv] linux/dim: Fix overflow in dim calculation
f95c89
f95c89
Message-id: <20190807142629.15867-1-ivecera@redhat.com>
f95c89
Patchwork-id: 268439
f95c89
O-Subject: [RHEL-8.2 net PATCH 9/9] linux/dim: Fix overflow in dim calculation
f95c89
Bugzilla: 1737807
f95c89
RH-Acked-by: Kamal Heib <kheib@redhat.com>
f95c89
RH-Acked-by: Corinna Vinschen <vinschen@redhat.com>
f95c89
RH-Acked-by: Jonathan Toppins <jtoppins@redhat.com>
f95c89
RH-Acked-by: John Linville <linville@redhat.com>
f95c89
f95c89
Bugzilla: http://bugzilla.redhat.com/show_bug.cgi?id=1737807
f95c89
f95c89
Upstream commit(s):
f95c89
commit f06d0ca45827a5790d7508de4759aed976933d4d
f95c89
Author: Yamin Friedman <yaminf@mellanox.com>
f95c89
Date:   Tue Jul 23 10:22:47 2019 +0300
f95c89
f95c89
    linux/dim: Fix overflow in dim calculation
f95c89
f95c89
    While using net_dim, a dim_sample was used without ever initializing the
f95c89
    comps value. Added use of DIV_ROUND_DOWN_ULL() to prevent potential
f95c89
    overflow, it should not be a problem to save the final result in an int
f95c89
    because after the division by epms the value should not be larger than a
f95c89
    few thousand.
f95c89
f95c89
    [ 1040.127124] UBSAN: Undefined behaviour in lib/dim/dim.c:78:23
f95c89
    [ 1040.130118] signed integer overflow:
f95c89
    [ 1040.131643] 134718714 * 100 cannot be represented in type 'int'
f95c89
f95c89
    Fixes: 398c2b05bbee ("linux/dim: Add completions count to dim_sample")
f95c89
    Signed-off-by: Yamin Friedman <yaminf@mellanox.com>
f95c89
    Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
f95c89
    Acked-by: Saeed Mahameed <saeedm@mellanox.com>
f95c89
    Signed-off-by: David S. Miller <davem@davemloft.net>
f95c89
f95c89
Signed-off-by: Ivan Vecera <ivecera@redhat.com>
f95c89
Signed-off-by: Jiri Benc <jbenc@redhat.com>
f95c89
f95c89
Signed-off-by: Timothy Redaelli <tredaelli@redhat.com>
f95c89
Signed-off-by: Phillip Lougher <plougher@redhat.com>
f95c89
---
f95c89
 drivers/net/ethernet/broadcom/bnxt/bnxt.c | 2 +-
f95c89
 1 file changed, 1 insertion(+), 1 deletion(-)
f95c89
f95c89
Index: src/drivers/net/ethernet/broadcom/bnxt/bnxt.c
f95c89
===================================================================
f95c89
--- src.orig/drivers/net/ethernet/broadcom/bnxt/bnxt.c	2020-02-06 16:22:57.646678963 +0100
f95c89
+++ src/drivers/net/ethernet/broadcom/bnxt/bnxt.c	2020-02-06 16:23:10.933557001 +0100
f95c89
@@ -2132,7 +2132,7 @@
f95c89
 		}
f95c89
 	}
f95c89
 	if (bp->flags & BNXT_FLAG_DIM) {
f95c89
-		struct net_dim_sample dim_sample;
f95c89
+		struct net_dim_sample dim_sample = {};
f95c89
 
f95c89
 		net_dim_sample(cpr->event_ctr,
f95c89
 			       cpr->rx_packets,