[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <202403070958.BE50CCDC@keescook>
Date: Thu, 7 Mar 2024 09:59:14 -0800
From: Kees Cook <keescook@...omium.org>
To: Breno Leitao <leitao@...ian.org>
Cc: linux-wireless@...r.kernel.org, johannes.berg@...el.com,
gregory.greenman@...el.com,
Miri Korenblit <miriam.rachel.korenblit@...el.com>,
Kalle Valo <kvalo@...nel.org>, kuba@...nel.org,
Alon Giladi <alon.giladi@...el.com>,
Benjamin Berg <benjamin.berg@...el.com>,
Anjaneyulu <pagadala.yesu.anjaneyulu@...el.com>,
Avraham Stern <avraham.stern@...el.com>,
Christian Marangi <ansuelsmth@...il.com>,
open list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] wifi: iwlwifi: pcie: allocate dummy net_device
dynamically
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@...ian.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@...omium.org>
--
Kees Cook
Powered by blists - more mailing lists