All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: David Laight <David.Laight@ACULAB.COM>,
	'Martin Willi' <martin@strongswan.org>
Cc: "linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: Re: [PATCH 2/2] mac80211_hwsim: Allow managing radios from non-initial namespaces
Date: Mon, 09 May 2016 09:31:30 +0200	[thread overview]
Message-ID: <1462779090.30690.3.camel@sipsolutions.net> (raw)
In-Reply-To: <063D6719AE5E284EB5DD2968C1650D6D5F4B5302@AcuExch.aculab.com>


> > 
> > +	data->netgroup = *(int *)net_generic(net, hwsim_net_id);
> Anything doing *(integer_type *) rings alarm bells.
> 
> I suspect you should be defining a structure that currently contains
> one integer member.
> Something (maybe a compile time assert) needs to check that buffer
> space you are accessing (where ever it is) is large enough.
> 

It does look a bit awkward, but there's no value in having a struct -
you still have an opaque pointer here and cast it to something whose
size you assume to be present... it really makes no difference.

johannes

WARNING: multiple messages have this Message-ID (diff)
From: Johannes Berg <johannes-cdvu00un1VgdHxzADdlk8Q@public.gmane.org>
To: David Laight
	<David.Laight-ZS65k/vG3HxXrIkS9f7CXA@public.gmane.org>,
	'Martin Willi' <martin-jzJueiEJWxp8fCCB1iTX4w@public.gmane.org>
Cc: "linux-wireless-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-wireless-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	"netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: [PATCH 2/2] mac80211_hwsim: Allow managing radios from non-initial namespaces
Date: Mon, 09 May 2016 09:31:30 +0200	[thread overview]
Message-ID: <1462779090.30690.3.camel@sipsolutions.net> (raw)
In-Reply-To: <063D6719AE5E284EB5DD2968C1650D6D5F4B5302-VkEWCZq2GCInGFn1LkZF6NBPR1lH4CV8@public.gmane.org>


> > 
> > +	data->netgroup = *(int *)net_generic(net, hwsim_net_id);
> Anything doing *(integer_type *) rings alarm bells.
> 
> I suspect you should be defining a structure that currently contains
> one integer member.
> Something (maybe a compile time assert) needs to check that buffer
> space you are accessing (where ever it is) is large enough.
> 

It does look a bit awkward, but there's no value in having a struct -
you still have an opaque pointer here and cast it to something whose
size you assume to be present... it really makes no difference.

johannes
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2016-05-09  7:31 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-03  6:53 [PATCH 0/2] wireless: Allow wiphy/hwsim management from user namespaces Martin Willi
2016-05-03  6:53 ` Martin Willi
2016-05-03  6:53 ` [PATCH 1/2] nl80211: Allow privileged operations " Martin Willi
2016-05-03  6:53 ` [PATCH 2/2] mac80211_hwsim: Allow managing radios from non-initial namespaces Martin Willi
2016-05-03  6:56   ` Johannes Berg
2016-05-03  7:50     ` Martin Willi
2016-05-03 19:16   ` Johannes Berg
2016-05-03 19:16     ` Johannes Berg
2016-05-04  8:33     ` Martin Willi
2016-05-04  8:33       ` Martin Willi
2016-05-09  7:30       ` Johannes Berg
2016-05-09 16:33         ` Martin Willi
2016-05-09 16:33           ` Martin Willi
2016-05-05 10:16   ` David Laight
2016-05-09  7:31     ` Johannes Berg [this message]
2016-05-09  7:31       ` 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=1462779090.30690.3.camel@sipsolutions.net \
    --to=johannes@sipsolutions.net \
    --cc=David.Laight@ACULAB.COM \
    --cc=linux-wireless@vger.kernel.org \
    --cc=martin@strongswan.org \
    --cc=netdev@vger.kernel.org \
    /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.