All of lore.kernel.org
 help / color / mirror / Atom feed
From: Felix Fietkau <nbd@openwrt.org>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: Stephen Hemminger <shemminger@vyatta.com>,
	John Linville <linville@tuxdriver.com>,
	linux-wireless@vger.kernel.org
Subject: Re: Fw: [Bug 51901] New: mac80211/cfg.c:1995: possible bad call to memcpy ?
Date: Thu, 27 Dec 2012 09:30:59 +0100	[thread overview]
Message-ID: <50DC0743.8050608@openwrt.org> (raw)
In-Reply-To: <1356594315.15149.1.camel@jlt4.sipsolutions.net>

On 2012-12-27 8:45 AM, Johannes Berg wrote:
> On Sat, 2012-12-22 at 13:55 -0800, Stephen Hemminger wrote:
> 
>> static int ieee80211_set_mcast_rate(struct wiphy *wiphy, struct net_device
>> *dev,
>>                     int rate[IEEE80211_NUM_BANDS])
>> {
>>     struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
>> 
>>     memcpy(sdata->vif.bss_conf.mcast_rate, rate, sizeof(rate));
> 
> Seems fine to me. If anyone's bothered by the warning, patch welcome,
> but the code is ok since it's an array.
I think the warning is correct and the code needs to be fixed. Since
rate is a function parameter, sizeof(rate) == sizeof(int).
I didn't know about this weird aspect of the C standard either, but I
verified it with a simple user space test program. ;)

- Felix

  reply	other threads:[~2012-12-27  8:32 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-22 21:55 Fw: [Bug 51901] New: mac80211/cfg.c:1995: possible bad call to memcpy ? Stephen Hemminger
2012-12-27  7:45 ` Johannes Berg
2012-12-27  8:30   ` Felix Fietkau [this message]
2012-12-27  8:49     ` Johannes Berg

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=50DC0743.8050608@openwrt.org \
    --to=nbd@openwrt.org \
    --cc=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --cc=shemminger@vyatta.com \
    /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 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.