From: Leon Romanovsky <leon@kernel.org>
To: Sven Auhagen <sven.auhagen@voleatech.de>
Cc: netdev@vger.kernel.org, thomas.petazzoni@bootlin.com,
brouer@redhat.com, lorenzo@kernel.org, Paulo.DaSilva@kyberna.com,
ilias.apalodimas@linaro.org, mcroce@microsoft.com
Subject: Re: [PATCH v3 1/2] net: page_pool: check page pool ethtool stats
Date: Sun, 15 Oct 2023 20:27:10 +0300 [thread overview]
Message-ID: <20231015172710.GA223096@unreal> (raw)
In-Reply-To: <be2yyb4ksuzj2d4yhvfzj43fswdtqmcqxv5dplmi6qy7vr4don@ksativ2xr33e>
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@voleatech.de>
> Reported-by: Paulo Da Silva <Paulo.DaSilva@kyberna.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
> /* 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
>
>
next prev parent reply other threads:[~2023-10-15 17:27 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-15 12:37 [PATCH v3 1/2] net: page_pool: check page pool ethtool stats Sven Auhagen
2023-10-15 17:27 ` Leon Romanovsky [this message]
2023-10-25 2:12 ` Sven Auhagen
2023-10-25 2:28 ` Yunsheng Lin
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=20231015172710.GA223096@unreal \
--to=leon@kernel.org \
--cc=Paulo.DaSilva@kyberna.com \
--cc=brouer@redhat.com \
--cc=ilias.apalodimas@linaro.org \
--cc=lorenzo@kernel.org \
--cc=mcroce@microsoft.com \
--cc=netdev@vger.kernel.org \
--cc=sven.auhagen@voleatech.de \
--cc=thomas.petazzoni@bootlin.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).