net/wan/fsl_ucc_hdlc: fix out of bounds write on array utdm_info
authorColin Ian King <colin.king@canonical.com>
Tue, 14 Jan 2020 14:54:48 +0000 (14:54 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 23 Jan 2020 07:19:41 +0000 (08:19 +0100)
[ Upstream commit ddf420390526ede3b9ff559ac89f58cb59d9db2f ]

Array utdm_info is declared as an array of MAX_HDLC_NUM (4) elements
however up to UCC_MAX_NUM (8) elements are potentially being written
to it.  Currently we have an array out-of-bounds write error on the
last 4 elements. Fix this by making utdm_info UCC_MAX_NUM elements in
size.

Addresses-Coverity: ("Out-of-bounds write")
Fixes: c19b6d246a35 ("drivers/net: support hdlc function for QE-UCC")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/wan/fsl_ucc_hdlc.c

index b2c1e872d5ed5d6348fa118a8378856bef8813b5..af85a1b3135e2cead207757edbc9018cfa082c0e 100644 (file)
@@ -77,7 +77,7 @@ static struct ucc_tdm_info utdm_primary_info = {
        },
 };
 
-static struct ucc_tdm_info utdm_info[MAX_HDLC_NUM];
+static struct ucc_tdm_info utdm_info[UCC_MAX_NUM];
 
 static int uhdlc_init(struct ucc_hdlc_private *priv)
 {