lkml.org 
[lkml]   [2022]   [Nov]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: [EXT] Re: [PATCH v4 1/2] net: page_pool: export page_pool_stats definition
Date


> -----Original Message-----
> From: Andrew Lunn <andrew@lunn.ch>
> Sent: Tuesday, November 15, 2022 11:12 AM
> To: Shenwei Wang <shenwei.wang@nxp.com>
> Cc: David S. Miller <davem@davemloft.net>; Eric Dumazet
> <edumazet@google.com>; Jakub Kicinski <kuba@kernel.org>; Paolo Abeni
> <pabeni@redhat.com>; Jesper Dangaard Brouer <hawk@kernel.org>; Ilias
> Apalodimas <ilias.apalodimas@linaro.org>; Alexei Starovoitov
> <ast@kernel.org>; Daniel Borkmann <daniel@iogearbox.net>; John Fastabend
> <john.fastabend@gmail.com>; netdev@vger.kernel.org; linux-
> kernel@vger.kernel.org; imx@lists.linux.dev
> Subject: [EXT] Re: [PATCH v4 1/2] net: page_pool: export page_pool_stats
> definition
>
> Caution: EXT Email
>
> On Tue, Nov 15, 2022 at 09:57:43AM -0600, Shenwei Wang wrote:
> > The definition of the 'struct page_pool_stats' is required even when
> > the CONFIG_PAGE_POOL_STATS is not defined. Otherwise, it is required
> > the drivers to handle the case of CONFIG_PAGE_POOL_STATS undefined.
>
> I agree the API is broken, but i think there is a better fix.
>
> There should be a stub of page_pool_get_stats() for when
> CONFIG_PAGE_POOL_STATS is disabled.
>
> Nothing actually dereferences struct page_pool_stats when you have this stub.
> So it might be enough to simply have
>
> struct page_pool_stats{
> };
>

As the structure is open when the CONFIG_PAGE_POOL_STATS is enabled, you can not
prevent a user to access its members. The empty stub will still have problems in this
kind of situations.

Regards,
Shenwei

> Andrew

\
 
 \ /
  Last update: 2022-11-15 18:19    [W:0.071 / U:0.720 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site