All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] mac80211: correct size the argument to kzalloc in minstrel_ht
@ 2012-06-29 13:26 Thomas Huehn
  2012-06-29 13:56 ` Johannes Berg
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas Huehn @ 2012-06-29 13:26 UTC (permalink / raw)
  To: linux-wireless
  Cc: linville, franzschrober, julian.calaby, johannes, thomas, nbd

msp has type struct minstrel_ht_sta_priv not struct minstrel_ht_sta.

Signed-off-by: Thomas Huehn <thomas@net.t-labs.tu-berlin.de>
---
Use suggested coding style. Thx to Schrober.
---
 net/mac80211/rc80211_minstrel_ht.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/mac80211/rc80211_minstrel_ht.c b/net/mac80211/rc80211_minstrel_ht.c
index 2d1acc6..1ca8f2b 100644
--- a/net/mac80211/rc80211_minstrel_ht.c
+++ b/net/mac80211/rc80211_minstrel_ht.c
@@ -809,11 +809,11 @@ minstrel_ht_alloc_sta(void *priv, struct ieee80211_sta *sta, gfp_t gfp)
 			max_rates = sband->n_bitrates;
 	}
 
-	msp = kzalloc(sizeof(struct minstrel_ht_sta), gfp);
+	msp = kzalloc(sizeof(*msp), gfp);
 	if (!msp)
 		return NULL;
 
-	msp->ratelist = kzalloc(sizeof(struct minstrel_rate) * max_rates, gfp);
+	msp->ratelist = kzalloc(sizeof(*msp->ratelist) * max_rates, gfp);
 	if (!msp->ratelist)
 		goto error;
 
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] mac80211: correct size the argument to kzalloc in minstrel_ht
  2012-06-29 13:26 [PATCH v2] mac80211: correct size the argument to kzalloc in minstrel_ht Thomas Huehn
@ 2012-06-29 13:56 ` Johannes Berg
  2012-06-29 15:24   ` Joe Perches
  0 siblings, 1 reply; 3+ messages in thread
From: Johannes Berg @ 2012-06-29 13:56 UTC (permalink / raw)
  To: Thomas Huehn
  Cc: linux-wireless, John Linville, franzschrober, julian.calaby, nbd

On Fri, 2012-06-29 at 06:26 -0700, Thomas Huehn wrote:
> msp has type struct minstrel_ht_sta_priv not struct minstrel_ht_sta.
> 
> Signed-off-by: Thomas Huehn <thomas@net.t-labs.tu-berlin.de>

Acked-by: Johannes Berg <johannes@sipsolutions.net>

I guess it worked anyway because the allocations are usually rounded up.

> ---
> Use suggested coding style. Thx to Schrober.
> ---
>  net/mac80211/rc80211_minstrel_ht.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/net/mac80211/rc80211_minstrel_ht.c b/net/mac80211/rc80211_minstrel_ht.c
> index 2d1acc6..1ca8f2b 100644
> --- a/net/mac80211/rc80211_minstrel_ht.c
> +++ b/net/mac80211/rc80211_minstrel_ht.c
> @@ -809,11 +809,11 @@ minstrel_ht_alloc_sta(void *priv, struct ieee80211_sta *sta, gfp_t gfp)
>  			max_rates = sband->n_bitrates;
>  	}
>  
> -	msp = kzalloc(sizeof(struct minstrel_ht_sta), gfp);
> +	msp = kzalloc(sizeof(*msp), gfp);
>  	if (!msp)
>  		return NULL;
>  
> -	msp->ratelist = kzalloc(sizeof(struct minstrel_rate) * max_rates, gfp);
> +	msp->ratelist = kzalloc(sizeof(*msp->ratelist) * max_rates, gfp);
>  	if (!msp->ratelist)
>  		goto error;
>  



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] mac80211: correct size the argument to kzalloc in minstrel_ht
  2012-06-29 13:56 ` Johannes Berg
@ 2012-06-29 15:24   ` Joe Perches
  0 siblings, 0 replies; 3+ messages in thread
From: Joe Perches @ 2012-06-29 15:24 UTC (permalink / raw)
  To: Johannes Berg
  Cc: Thomas Huehn, linux-wireless, John Linville, franzschrober,
	julian.calaby, nbd

On Fri, 2012-06-29 at 15:56 +0200, Johannes Berg wrote:
> On Fri, 2012-06-29 at 06:26 -0700, Thomas Huehn wrote:
[]
> > diff --git a/net/mac80211/rc80211_minstrel_ht.c b/net/mac80211/rc80211_minstrel_ht.c
[]
> > @@ -809,11 +809,11 @@ minstrel_ht_alloc_sta(void *priv, struct ieee80211_sta *sta, gfp_t gfp)
> >  			max_rates = sband->n_bitrates;
> >  	}
> >  
> > -	msp = kzalloc(sizeof(struct minstrel_ht_sta), gfp);
> > +	msp = kzalloc(sizeof(*msp), gfp);
> >  	if (!msp)
> >  		return NULL;
> >  
> > -	msp->ratelist = kzalloc(sizeof(struct minstrel_rate) * max_rates, gfp);
> > +	msp->ratelist = kzalloc(sizeof(*msp->ratelist) * max_rates, gfp);

trivia: this might be better as kcalloc



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-06-29 15:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-29 13:26 [PATCH v2] mac80211: correct size the argument to kzalloc in minstrel_ht Thomas Huehn
2012-06-29 13:56 ` Johannes Berg
2012-06-29 15:24   ` Joe Perches

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.