net: mac80211/cfg.c: fix error using of sizeof()
Subsystems (3)
PATCH 1/1 net: mac80211/cfg.c: fix error using of sizeof()
Using 'sizeof' on array given as function argument returns size of a pointer rather than the size of array.
--- net/mac80211/cfg.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/mac80211/cfg.c +2 -1
@@ -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 );return 0 ; }
Signature · 1 line
1.7.9.5
Johannes Berg
maintainerQuoted 2 lines · Cong Ding
Using 'sizeof' on array given as function argument returns size of a pointer rather than the size of array.
Oops, yeah, Stephen Hemminger pointed this out a month or so ago and I forgot to change it, thanks.
johannes
Quoted 6 lines · Johannes Berg
Quoted 2 lines · Cong Ding
Using 'sizeof' on array given as function argument returns size of a pointer rather than the size of array.
Oops, yeah, Stephen Hemminger pointed this out a month or so ago and I forgot to change it, thanks.
This needs to be back-ported for 3.7 stable? Perhaps the code below corresponds (from copy_mesh_setup)?
/* mcast rate setting in Mesh Node */ memcpy(sdata->vif.bss_conf.mcast_rate, setup->mcast_rate, sizeof(setup->mcast_rate));
Thanks,
Ben
Signature · 2 lines
Ben Greear <[email protected]> Candela Technologies Inc http://www.candelatech.com
Quoted 8 lines · Ben Greear
Quoted 6 lines · Johannes Berg
Quoted 2 lines · Cong Ding
Using 'sizeof' on array given as function argument returns size of a pointer rather than the size of array.
Oops, yeah, Stephen Hemminger pointed this out a month or so ago and I forgot to change it, thanks.
Quoted 7 lines
This needs to be back-ported for 3.7 stable? Perhaps the code below corresponds (from
copy_mesh_setup)?/* mcast rate setting in Mesh Node */ memcpy(sdata->vif.bss_conf.mcast_rate, setup->mcast_rate, sizeof(setup->mcast_rate));
Nevermind..I think I'm wrong about that..the sizeof probably works fine here. Sorry for the noise.
Ben
Quoted 4 lines
Thanks,
Ben
Signature · 2 lines
Ben Greear <[email protected]> Candela Technologies Inc http://www.candelatech.com
Quoted 13 lines · Cong Ding
Using 'sizeof' on array given as function argument returns size of a pointer rather than the size of array.
Signed-off-by Cong Ding <[email protected]>--- net/mac80211/cfg.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)net/mac80211/cfg.c +0
-0
net/mac80211/cfg.c static int ieee80211_set_mcast_rate(struct wiphy *wiphy, struct net_device *dev, · line 2062
Quoted 6 lines
net/mac80211/cfg.c +2
-1@@ -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
Quoted 4 lines
net/mac80211/cfg.c +0
-0return 0 ; }
Signature · 7 lines
Ben Greear <greearb-my8/[email protected]> Candela Technologies Inc http://www.candelatech.com -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
David Miller
maintainerFrom: Cong Ding <[email protected]>
Date: Wed, 6 Feb 2013 17:23:45 +0100
Quoted 13 lines
Using 'sizeof' on array given as function argument returns size of a pointer rather than the size of array.
Signed-off-by Cong Ding <[email protected]>--- net/mac80211/cfg.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)net/mac80211/cfg.c +0
-0
net/mac80211/cfg.c static int ieee80211_set_mcast_rate(struct wiphy *wiphy, struct net_device *dev, · line 2063
Quoted 7 lines
net/mac80211/cfg.c +2
-1@@ -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 );
This is not indented properly. The "sizeof(int..." should start at the first column after the openning parenthesis of the memcpy() call.
Johannes Berg
maintainerQuoted 19 lines · David Miller
From: Cong Ding <[email protected]>
Date: Wed, 6 Feb 2013 17:23:45 +0100Quoted 16 lines
Using 'sizeof' on array given as function argument returns size of a pointer rather than the size of array.
Signed-off-by Cong Ding <[email protected]>--- net/mac80211/cfg.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)net/mac80211/cfg.c +0
-0@@ -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);
Quoted 7 lines
net/mac80211/cfg.c static int ieee80211_set_mcast_rate(struct wiphy *wiphy, struct net_device *dev, · line 2063
Quoted 4 lines
net/mac80211/cfg.c +2
-1-memcpy (sdata->vif.bss_conf.mcast_rate, rate,sizeof (rate)); +memcpy (sdata->vif.bss_conf.mcast_rate, rate, +sizeof (int ) *IEEE80211_NUM_BANDS );This is not indented properly. The "sizeof(int..." should start at the first column after the openning parenthesis of the
memcpy()call.
Yeah I fixed it when I applied it ... oh well.
johannes