All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kees Cook <keescook@chromium.org>
To: Breno Leitao <leitao@debian.org>
Cc: linux-wireless@vger.kernel.org, johannes.berg@intel.com,
	gregory.greenman@intel.com,
	Miri Korenblit <miriam.rachel.korenblit@intel.com>,
	Kalle Valo <kvalo@kernel.org>,
	kuba@kernel.org, Alon Giladi <alon.giladi@intel.com>,
	Benjamin Berg <benjamin.berg@intel.com>,
	Anjaneyulu <pagadala.yesu.anjaneyulu@intel.com>,
	Avraham Stern <avraham.stern@intel.com>,
	Christian Marangi <ansuelsmth@gmail.com>,
	open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] wifi: iwlwifi: pcie: allocate dummy net_device dynamically
Date: Thu, 7 Mar 2024 09:59:14 -0800	[thread overview]
Message-ID: <202403070958.BE50CCDC@keescook> (raw)
In-Reply-To: <20240307174843.1719130-1-leitao@debian.org>

On Thu, Mar 07, 2024 at 09:48:31AM -0800, Breno Leitao wrote:
> struct net_device shouldn't be embedded into any structure, instead,
> the owner should use the priv space to embed their state into net_device.
> 
> Embedding net_device into structures prohibits the usage of flexible
> arrays in the net_device structure. For more details, see the discussion
> at [1].
> 
> Un-embed the net_device from struct iwl_trans_pcie by converting it
> into a pointer. Then use the leverage alloc_netdev() to allocate the
> net_device object at iwl_trans_pcie_alloc.
> 
> The private data of net_device becomes a pointer for the struct
> iwl_trans_pcie, so, it is easy to get back to the iwl_trans_pcie parent
> given the net_device object.
> 
> [1] https://lore.kernel.org/all/20240229225910.79e224cf@kernel.org/
> 
> Signed-off-by: Breno Leitao <leitao@debian.org>

Ah, nice! Thanks for doing this.

I had to double-check the pointer-to-pointer stuff, but it makes sense
to me now. :)

Reviewed-by: Kees Cook <keescook@chromium.org>

-- 
Kees Cook

      reply	other threads:[~2024-03-07 17:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-07 17:48 [PATCH] wifi: iwlwifi: pcie: allocate dummy net_device dynamically Breno Leitao
2024-03-07 17:59 ` Kees Cook [this message]

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=202403070958.BE50CCDC@keescook \
    --to=keescook@chromium.org \
    --cc=alon.giladi@intel.com \
    --cc=ansuelsmth@gmail.com \
    --cc=avraham.stern@intel.com \
    --cc=benjamin.berg@intel.com \
    --cc=gregory.greenman@intel.com \
    --cc=johannes.berg@intel.com \
    --cc=kuba@kernel.org \
    --cc=kvalo@kernel.org \
    --cc=leitao@debian.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=miriam.rachel.korenblit@intel.com \
    --cc=pagadala.yesu.anjaneyulu@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.