fsl/fman: fix eth hash table allocation
authorFlorinel Iordache <florinel.iordache@nxp.com>
Mon, 3 Aug 2020 07:07:34 +0000 (10:07 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 21 Aug 2020 09:02:04 +0000 (11:02 +0200)
[ Upstream commit 3207f715c34317d08e798e11a10ce816feb53c0f ]

Fix memory allocation for ethernet address hash table.
The code was wrongly allocating an array for eth hash table which
is incorrect because this is the main structure for eth hash table
(struct eth_hash_t) that contains inside a number of elements.

Fixes: 57ba4c9b56d8 ("fsl/fman: Add FMan MAC support")
Signed-off-by: Florinel Iordache <florinel.iordache@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/freescale/fman/fman_mac.h

index dd6d0526f6c1f562ff858b4c72a9f1ec5691cc67..19f327efdaff3e62b5ae484fa372663f3326a965 100644 (file)
@@ -252,7 +252,7 @@ static inline struct eth_hash_t *alloc_hash_table(u16 size)
        struct eth_hash_t *hash;
 
        /* Allocate address hash table */
-       hash = kmalloc_array(size, sizeof(struct eth_hash_t *), GFP_KERNEL);
+       hash = kmalloc(sizeof(*hash), GFP_KERNEL);
        if (!hash)
                return NULL;