[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <fusfdpsgmo5cc55mokt2wasdx6flbgczho7yntj7fmiwchenft@luglcjwvedsq>
Date: Wed, 25 Oct 2023 04:12:05 +0200
From: Sven Auhagen <sven.auhagen@...eatech.de>
To: Leon Romanovsky <leon@...nel.org>
Cc: netdev@...r.kernel.org, thomas.petazzoni@...tlin.com,
brouer@...hat.com, lorenzo@...nel.org, Paulo.DaSilva@...erna.com,
ilias.apalodimas@...aro.org, mcroce@...rosoft.com
Subject: Re: [PATCH v3 1/2] net: page_pool: check page pool ethtool stats
On Sun, Oct 15, 2023 at 08:27:10PM +0300, Leon Romanovsky wrote:
> On Sun, Oct 15, 2023 at 02:37:27PM +0200, Sven Auhagen wrote:
> > If the page_pool variable is null while passing it to
> > the page_pool_get_stats function we receive a kernel error.
> >
> > Check if the page_pool variable is at least valid.
> >
> > Signed-off-by: Sven Auhagen <sven.auhagen@...eatech.de>
> > Reported-by: Paulo Da Silva <Paulo.DaSilva@...erna.com>
> > ---
> > net/core/page_pool.c | 3 +++
> > 1 file changed, 3 insertions(+)
> >
> > diff --git a/net/core/page_pool.c b/net/core/page_pool.c
> > index 2396c99bedea..4c5dca6b4a16 100644
> > --- a/net/core/page_pool.c
> > +++ b/net/core/page_pool.c
> > @@ -65,6 +65,9 @@ bool page_pool_get_stats(struct page_pool *pool,
> > if (!stats)
> > return false;
> >
> > + if (!pool)
> > + return false;
> > +
>
> I would argue that both pool and stats shouldn't be NULL and must be
> checked by caller. This API call named get-stats-from-pool.
>
> Thanks
I can do it either way, I only need to know which version to send.
Can someone let me know how to proceed with the patch?
Best
Sven
>
> > /* The caller is responsible to initialize stats. */
> > stats->alloc_stats.fast += pool->alloc_stats.fast;
> > stats->alloc_stats.slow += pool->alloc_stats.slow;
> > --
> > 2.42.0
> >
> >
Powered by blists - more mailing lists