linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Florinel Iordache <florinel.iordache@nxp.com>
To: madalin.bucur@nxp.com, davem@davemloft.net, kuba@kernel.org,
	netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org,
	Florinel Iordache <florinel.iordache@nxp.com>
Subject: [PATCH net v3 5/5] fsl/fman: fix eth hash table allocation
Date: Mon,  3 Aug 2020 10:07:34 +0300	[thread overview]
Message-ID: <1596438454-4895-6-git-send-email-florinel.iordache@nxp.com> (raw)
In-Reply-To: <1596438454-4895-1-git-send-email-florinel.iordache@nxp.com>

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>
---
 drivers/net/ethernet/freescale/fman/fman_mac.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/freescale/fman/fman_mac.h b/drivers/net/ethernet/freescale/fman/fman_mac.h
index dd6d052..19f327e 100644
--- a/drivers/net/ethernet/freescale/fman/fman_mac.h
+++ b/drivers/net/ethernet/freescale/fman/fman_mac.h
@@ -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;
 
-- 
1.9.1


  parent reply	other threads:[~2020-08-03  7:08 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-03  7:07 [PATCH net v3 0/5] DPAA FMan driver fixes Florinel Iordache
2020-08-03  7:07 ` [PATCH net v3 1/5] fsl/fman: use 32-bit unsigned integer Florinel Iordache
2020-08-03  7:07 ` [PATCH net v3 2/5] fsl/fman: fix dereference null return value Florinel Iordache
2020-08-03  7:07 ` [PATCH net v3 3/5] fsl/fman: fix unreachable code Florinel Iordache
2020-08-03  7:07 ` [PATCH net v3 4/5] fsl/fman: check dereferencing null pointer Florinel Iordache
2020-08-03  7:07 ` Florinel Iordache [this message]
2020-08-03  8:26 ` [PATCH net v3 0/5] DPAA FMan driver fixes Madalin Bucur (OSS)
2020-08-03 23:20 ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1596438454-4895-6-git-send-email-florinel.iordache@nxp.com \
    --to=florinel.iordache@nxp.com \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=madalin.bucur@nxp.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).