All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: Gerrit Renker <gerrit@erg.abdn.ac.uk>
Cc: "John W. Linville" <linville@tuxdriver.com>,
	linux-wireless@vger.kernel.org
Subject: Re: [Patch 1/1] wext: fix 32/64 bit alignment issue for 'point' type
Date: Thu, 30 Sep 2010 16:40:48 +0200	[thread overview]
Message-ID: <1285857648.5137.4.camel@jlt3.sipsolutions.net> (raw)
In-Reply-To: <1285857487.5137.2.camel@jlt3.sipsolutions.net>

On Thu, 2010-09-30 at 16:38 +0200, Johannes Berg wrote:
> On Thu, 2010-09-30 at 12:25 +0200, Gerrit Renker wrote:
> > wireless: fix alignment problem
> > 
> > With the current definition, IW_EV_POINT_PK_LEN is 12 on 64-bit and 8 on 32-bit systems,
> > due to the way struct iw_event is packed (24 byte on 64-bit systems instead of 20 byte
> > on 32-bit systems). Furthermore, the iwe_stream_add_point() in include/net/iw_handler.h
> > also uses IW_EV_LCP_PK_LEN as header length. 
> > 
> > The current definition appears to be a typo (PK_LEN instead of LEN); it causes 
> > misalignment on 64 bit systems.
> 
> So, correct me if I'm wrong, the only effect this change has is changing
> the second memcpy() in iwe_stream_add_point() to not copy an extra 4
> bytes that will be overwritten right away by the next memcpy()
> (presumably, unless the data is < 4, in which case the memcpy might
> actually be out of bounds).

Interestingly -- yay for wext! -- wireless-tools source code actually
uses the define you propose:

#define IW_EV_POINT_PK_LEN	(IW_EV_LCP_PK_LEN + 4)

which probably means that it was fixed there but the fix never
propagated to the kernel ...

johannes


  reply	other threads:[~2010-09-30 14:40 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-30 10:25 [Patch 1/1] wext: fix 32/64 bit alignment issue for 'point' type Gerrit Renker
2010-09-30 14:38 ` Johannes Berg
2010-09-30 14:40   ` Johannes Berg [this message]
2010-10-01  7:22   ` gerrit
2010-10-01  8:30     ` Johannes Berg
2010-10-11  5:14       ` Gerrit Renker
2010-10-11  9:55         ` Johannes Berg
2010-10-11 11:56           ` gerrit
2010-10-11 12:00             ` Johannes Berg
2010-10-12  5:07               ` [Patch v2 1/1] wext: fix alignment problem in serializing 'struct iw_point' Gerrit Renker

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=1285857648.5137.4.camel@jlt3.sipsolutions.net \
    --to=johannes@sipsolutions.net \
    --cc=gerrit@erg.abdn.ac.uk \
    --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 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.