diff mbox

p54: allocate enough space for ->used_rxkeys

Message ID 20170506004835.a5awr4v5rba2pmu5@mwanda (mailing list archive)
State Accepted
Commit c239838fbd6d5aadac193e02d0cf1866238da97b
Delegated to: Kalle Valo
Headers show

Commit Message

Dan Carpenter May 6, 2017, 12:48 a.m. UTC
We have the number of longs, but we should be calculating the number of
bytes needed.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Comments

Kalle Valo May 22, 2017, 3:31 p.m. UTC | #1
Dan Carpenter <dan.carpenter@oracle.com> wrote:
> We have the number of longs, but we should be calculating the number of
> bytes needed.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> diff --git a/drivers/net/wireless/intersil/p54/fwio.c b/drivers/net/wireless/intersil/p54/fwio.c
> index 4ac6764f4897..3076f646c829 100644
> --- a/drivers/net/wireless/intersil/p54/fwio.c
> +++ b/drivers/net/wireless/intersil/p54/fwio.c
> @@ -176,8 +176,9 @@ int p54_parse_firmware(struct ieee80211_hw *dev, const struct firmware *fw)
>  		 * keeping a extra list for uploaded keys.
>  		 */
>  
> -		priv->used_rxkeys = kzalloc(BITS_TO_LONGS(
> -			priv->rx_keycache_size), GFP_KERNEL);
> +		priv->used_rxkeys = kcalloc(BITS_TO_LONGS(priv->rx_keycache_size),
> +					    sizeof(long),
> +					    GFP_KERNEL);
>  
>  		if (!priv->used_rxkeys)
>  			return -ENOMEM;

Patch applied to wireless-drivers-next.git, thanks.

c239838fbd6d p54: allocate enough space for ->used_rxkeys
diff mbox

Patch

diff --git a/drivers/net/wireless/intersil/p54/fwio.c b/drivers/net/wireless/intersil/p54/fwio.c
index 4ac6764f4897..3076f646c829 100644
--- a/drivers/net/wireless/intersil/p54/fwio.c
+++ b/drivers/net/wireless/intersil/p54/fwio.c
@@ -176,8 +176,9 @@  int p54_parse_firmware(struct ieee80211_hw *dev, const struct firmware *fw)
 		 * keeping a extra list for uploaded keys.
 		 */
 
-		priv->used_rxkeys = kzalloc(BITS_TO_LONGS(
-			priv->rx_keycache_size), GFP_KERNEL);
+		priv->used_rxkeys = kcalloc(BITS_TO_LONGS(priv->rx_keycache_size),
+					    sizeof(long),
+					    GFP_KERNEL);
 
 		if (!priv->used_rxkeys)
 			return -ENOMEM;