All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: Kirtika Ruchandani <kirtika.ruchandani@gmail.com>,
	Julian Calaby <julian.calaby@gmail.com>
Cc: linux-wireless <linux-wireless@vger.kernel.org>,
	Tina Ruchandani <ruchandani.tina@gmail.com>,
	netdev <netdev@vger.kernel.org>
Subject: Re: [PATCH v2 03/10] nl80211: Prefer ether_addr_copy
Date: Tue, 31 May 2016 12:34:47 +0200	[thread overview]
Message-ID: <1464690887.3076.24.camel@sipsolutions.net> (raw)
In-Reply-To: <CAA-b7a8v8q5VnPxWw+o6Vj96KxeVhgfmZbre8+9rLRcB7-emyg@mail.gmail.com> (sfid-20160530_085018_965596_090D7309)


> The requirement is to be __aligned(2). I've added 4 instances of
> ether_addr_copy with 8 addresses as arguments.  Of these, the 4
> src arguments are really the same type (i.e. nla_data acting on a
> const nlattr*), so I'll try to reason about the 5 total cases below -
> 1. cfg->dst_mac should be 16-bit aligned due to the layout of
> struct cfg80211_wowlan_tcp. Its offset is 10 or 12 bytes in the
> structure depending on the system.

I wouldn't want to rely on that, since internal structures can be
changed pretty easily. If necessary, add __aligned(2) to the struct
members where appropriate.

> 2 and 3. For mac_addr and mac_addr_mask, nl80211_parse_random_mac
> takes these in as u8* (and hence does not guarantee alignment?)
> Both the callers of this function today pass in arguments that are
> explicitly __aligned(2). But this cannot be said of future potential
> callers
> - so perhaps my patch introduces a bug?

That should be documented, but it's also pretty tricky to
review/maintain that.

I general, I don't really see much reason to use ether_addr_copy() in
any of these code paths - it's not really a performance thing (in part
due to the alignment, ether_addr_copy can be faster)

> 4. Based on struct cfg80211_acl_data, acl->mac_addrs[i] should be not
> guaranteed to be __aligned(2).

See above.

> 5. For all the nla_data src arguments, the nla_data function returns
> ((char*) foo + 5) for pointer foo. So likely not __aligned(2).

Those should be aligned since the data is copied into an SKB, and +5
doesn't seem right - nla_data() should be +4.

johannes

  reply	other threads:[~2016-05-31 10:34 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-30  2:49 [PATCH v2 00/10] nl80211: Fix checkpatch.pl issues Kirtika Ruchandani
2016-05-30  2:50 ` [PATCH v2 01/10] nl80211: Fix checkpatch warnings Kirtika Ruchandani
2016-05-30  2:50   ` Kirtika Ruchandani
2016-05-30  2:51 ` [PATCH v2 02/10] nl80211: Fix checkpatch warnings about blank lines Kirtika Ruchandani
2016-05-30  2:51   ` Kirtika Ruchandani
2016-05-30  2:52 ` [PATCH v2 03/10] nl80211: Prefer ether_addr_copy Kirtika Ruchandani
2016-05-30  2:52   ` Kirtika Ruchandani
2016-05-30  5:21   ` Julian Calaby
2016-05-30  5:21     ` Julian Calaby
2016-05-30  6:50     ` Kirtika Ruchandani
2016-05-31 10:34       ` Johannes Berg [this message]
2016-05-30  2:52 ` [PATCH v2 04/10] nl80211: Fix checkpatch.pl warning about braces Kirtika Ruchandani
2016-05-30  2:52   ` Kirtika Ruchandani
2016-05-30  5:22   ` Julian Calaby
2016-05-30  5:22     ` Julian Calaby
2016-05-30  2:52 ` [PATCH v2 05/10] nl80211: Fix checkpatch.pl NULL comparison warning Kirtika Ruchandani
2016-05-30  2:52   ` Kirtika Ruchandani
2016-05-30  5:22   ` Julian Calaby
2016-05-30  2:53 ` [PATCH v2 06/10] nl80211: Various checkpatch.pl spacing fixes Kirtika Ruchandani
2016-05-30  2:53   ` Kirtika Ruchandani
2016-05-30  5:25   ` Julian Calaby
2016-05-30  6:04     ` Kirtika Ruchandani
2016-05-30  6:06       ` Julian Calaby
2016-05-30  6:07   ` Julian Calaby
2016-05-30  2:53 ` [PATCH v2 07/10] nl80211: Avoid multiple assignments on same line Kirtika Ruchandani
2016-05-30  2:53   ` Kirtika Ruchandani
2016-05-30  5:30   ` Julian Calaby
2016-05-30  5:30     ` Julian Calaby
2016-05-30  2:54 ` [PATCH v2 08/10] nl80211: Fix spelling Kirtika Ruchandani
2016-05-30  2:54   ` Kirtika Ruchandani
2016-05-30  5:31   ` Julian Calaby
2016-05-30  2:54 ` [PATCH v2 09/10] nl80211: Fix checkpatch.pl warning Kirtika Ruchandani
2016-05-30  2:54   ` Kirtika Ruchandani
2016-05-30  5:31   ` Julian Calaby
2016-05-30  5:31     ` Julian Calaby
2016-05-30  2:54 ` [PATCH v2 10/10] nl80211: Prefer kcalloc over kzalloc Kirtika Ruchandani
2016-05-30  2:54   ` Kirtika Ruchandani
2016-05-30  5:32   ` Julian Calaby
2016-05-30  5:32     ` Julian Calaby

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=1464690887.3076.24.camel@sipsolutions.net \
    --to=johannes@sipsolutions.net \
    --cc=julian.calaby@gmail.com \
    --cc=kirtika.ruchandani@gmail.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=ruchandani.tina@gmail.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.