All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: Daniel Halperin <dhalperi@cs.washington.edu>
Cc: julia@diku.dk, John Linville <linville@tuxdriver.com>,
	Wey-Yi W Guy <wey-yi.w.guy@intel.com>,
	Meenakshi Venkataraman <meenakshi.venkataraman@intel.com>,
	Alexander Diewald <alex@diewald.cc>,
	linux-wireless <linux-wireless@vger.kernel.org>
Subject: Re: [PATCH 3.1] iwlagn: fix stack corruption
Date: Tue, 13 Sep 2011 09:18:01 +0200	[thread overview]
Message-ID: <1315898281.4554.0.camel@jlt3.sipsolutions.net> (raw)
In-Reply-To: <CALSq=BYqNg_xukL5oJuu3pPqU=FcgR+Lov=PdGjMxtL3UNu8HA@mail.gmail.com> (sfid-20110912_211617_837991_28F0A685)

On Mon, 2011-09-12 at 12:14 -0700, Daniel Halperin wrote:
> On Mon, Sep 12, 2011 at 12:08 PM, Johannes Berg
> <johannes@sipsolutions.net> wrote:
> >
> > --- a/drivers/net/wireless/iwlwifi/iwl-agn-ucode.c      2011-09-12 21:01:34.000000000 +0200
> > +++ b/drivers/net/wireless/iwlwifi/iwl-agn-ucode.c      2011-09-12 21:01:43.000000000 +0200
> > @@ -167,7 +167,7 @@ static int iwlagn_set_temperature_offset
> >
> >        memset(&cmd, 0, sizeof(cmd));
> >        iwl_set_calib_hdr(&cmd.hdr, IWL_PHY_CALIBRATE_TEMP_OFFSET_CMD);
> > -       memcpy(&cmd.radio_sensor_offset, offset_calib, sizeof(offset_calib));
> > +       memcpy(&cmd.radio_sensor_offset, offset_calib, sizeof(*offset_calib));
> >        if (!(cmd.radio_sensor_offset))
> >                cmd.radio_sensor_offset = DEFAULT_RADIO_SENSOR_OFFSET;
> 
> Nice catch!
> 
> This kinda bug seems ideal for Julia Lawall's stuff to catch, doesn't it?
> 
> Right: memcpy(addr, obj, sizeof(*obj))
> Wrong: memcpy(addr, obj, sizeof(obj))

That thought occurred to me as well, but I had been debugging until late
at night so didn't even try to write a script to flag this. :)

johannes


  parent reply	other threads:[~2011-09-13  7:18 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-12 19:08 [PATCH 3.1] iwlagn: fix stack corruption Johannes Berg
2011-09-12 19:14 ` Daniel Halperin
2011-09-12 18:40   ` Guy, Wey-Yi
2011-09-12 19:24   ` Julia Lawall
2011-09-13  7:18   ` Johannes Berg [this message]
2011-09-12 19:55 ` Alexander Diewald

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=1315898281.4554.0.camel@jlt3.sipsolutions.net \
    --to=johannes@sipsolutions.net \
    --cc=alex@diewald.cc \
    --cc=dhalperi@cs.washington.edu \
    --cc=julia@diku.dk \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --cc=meenakshi.venkataraman@intel.com \
    --cc=wey-yi.w.guy@intel.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.