Linux wireless drivers development
 help / color / mirror / Atom feed
From: Stephen Hemminger <shemminger@vyatta.com>
To: John Linville <linville@tuxdriver.com>, linux-wireless@vger.kernel.org
Subject: Fw: [Bug 51901] New: mac80211/cfg.c:1995: possible bad call to memcpy ?
Date: Sat, 22 Dec 2012 13:55:45 -0800	[thread overview]
Message-ID: <20121222135545.1f134c5a@samsung-9> (raw)



Begin forwarded message:

Date: Sat, 22 Dec 2012 16:28:47 +0000 (UTC)
From: bugzilla-daemon@bugzilla.kernel.org
To: shemminger@linux-foundation.org
Subject: [Bug 51901] New: mac80211/cfg.c:1995: possible bad call to memcpy ?


https://bugzilla.kernel.org/show_bug.cgi?id=51901

           Summary: mac80211/cfg.c:1995: possible bad call to memcpy ?
           Product: Networking
           Version: 2.5
    Kernel Version: 3.8-rc1
          Platform: All
        OS/Version: Linux
              Tree: Mainline
            Status: NEW
          Severity: normal
          Priority: P1
         Component: Other
        AssignedTo: shemminger@linux-foundation.org
        ReportedBy: dcb314@hotmail.com
        Regression: Yes


The source code is 

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));

The compiler says

cfg.c: In function ‘int ieee80211_set_mcast_rate(wiphy*, net_device*, int*)’:
cfg.c:1995: warning: argument to ‘sizeof’ in ‘void* memcpy(void*, const void*,
size_t)’ call is the same expression as the source; did you mean to dereference
it? [-Wsizeof-pointer-memaccess]
     memcpy(rate2, rate, sizeof(rate));
                               ^

Here is static analyser cppcheck also finding the same problem

[linux-3.8-rc1/net/mac80211/cfg.c:1995]: (error) Using 'sizeof' on array given
as function argument returns size of a pointer.


Suggest code rework.

-- 
Configure bugmail: https://bugzilla.kernel.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

             reply	other threads:[~2012-12-22 21:55 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-22 21:55 Stephen Hemminger [this message]
2012-12-27  7:45 ` Fw: [Bug 51901] New: mac80211/cfg.c:1995: possible bad call to memcpy ? Johannes Berg
2012-12-27  8:30   ` Felix Fietkau
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=20121222135545.1f134c5a@samsung-9 \
    --to=shemminger@vyatta.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox