[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240229113706.42c877a1@kernel.org>
Date: Thu, 29 Feb 2024 11:37:06 -0800
From: Jakub Kicinski <kuba@...nel.org>
To: Kees Cook <keescook@...omium.org>
Cc: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>, Vinod Koul
<vkoul@...nel.org>, Linus Walleij <linus.walleij@...aro.org>, Jonathan
Cameron <Jonathan.Cameron@...wei.com>, Mark Brown <broonie@...nel.org>,
linux-arm-kernel@...ts.infradead.org, dmaengine@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-iio@...r.kernel.org,
linux-spi@...r.kernel.org, netdev@...r.kernel.org,
linux-hardening@...r.kernel.org, Jonathan Cameron <jic23@...nel.org>,
Lars-Peter Clausen <lars@...afoo.de>, "David S. Miller"
<davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>, Paolo Abeni
<pabeni@...hat.com>, "Gustavo A. R. Silva" <gustavoars@...nel.org>
Subject: Re: [PATCH v4 7/8] net-device: Use new helpers from overflow.h in
netdevice APIs
On Thu, 29 Feb 2024 11:08:58 -0800 Kees Cook wrote:
> > And some seem to be cargo-culted from out-of-tree code and are unused :S
>
> Ah, which can I remove?
The one in igc.h does not seem to be referenced by anything in the igc
directory. Pretty sure it's unused.
> As a further aside, this code:
>
> struct net_device *dev;
> ...
> struct net_device *p;
> ...
> /* ensure 32-byte alignment of whole construct */
> alloc_size += NETDEV_ALIGN - 1;
> p = kvzalloc(alloc_size, GFP_KERNEL_ACCOUNT | __GFP_RETRY_MAYFAIL);
> ...
> dev = PTR_ALIGN(p, NETDEV_ALIGN);
>
> Really screams for a dynamic-sized (bucketed) kmem_cache_alloc
> API. Alignment constraints can be described in a regular kmem_cache
> allocator (rather than this open-coded version). I've been intending to
> build that for struct msg_msg for a while now, and here's another user. :)
TBH I'm not sure why we align it :S
NETDEV_ALIGN is 32B so maybe some old cache aligning thing?
Powered by blists - more mailing lists