lkml.org 
[lkml]   [2013]   [Feb]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] net: mac80211/cfg.c: fix error using of sizeof()
On 02/06/2013 08:23 AM, Cong Ding wrote:
> Using 'sizeof' on array given as function argument returns size of a pointer
> rather than the size of array.
>
> Signed-off-by: Cong Ding <dinggnu@gmail.com>
> ---
> net/mac80211/cfg.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
> index 661b878..af561d5 100644
> --- a/net/mac80211/cfg.c
> +++ b/net/mac80211/cfg.c
> @@ -2058,7 +2058,8 @@ static int ieee80211_set_mcast_rate(struct wiphy *wiphy, struct net_device *dev,
> {
> struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
>
> - memcpy(sdata->vif.bss_conf.mcast_rate, rate, sizeof(rate));
> + memcpy(sdata->vif.bss_conf.mcast_rate, rate,
> + sizeof(int) * IEEE80211_NUM_BANDS);

Should it perhaps be: sizeof(*rate) * IEEE80211_NUM_BANDS
just in case the type ever changes?

Thanks,
Ben

>
> return 0;
> }
>


--
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc http://www.candelatech.com



\
 
 \ /
  Last update: 2013-02-06 19:21    [W:0.089 / U:0.636 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site