From: Patrick Robb <probb@iol.unh.edu>
To: Ariel Otilibili <ariel.otilibili@6wind.com>
Cc: dev@dpdk.org
Subject: Re: [PATCH v2 1/1] pcapng: warn if NULL is passed to rte_pcapng_close
Date: Tue, 25 Feb 2025 15:39:03 -0500 [thread overview]
Message-ID: <CAJvnSUCTKvqKFXGKtsgb8Fu1sk5s4UYzKMGw3YF-u1fq3fGOQw@mail.gmail.com> (raw)
In-Reply-To: <20250223214123.447579-2-ariel.otilibili@6wind.com>
[-- Attachment #1: Type: text/plain, Size: 2419 bytes --]
Recheck-request: iol-marvell-Functional
Putting in a recheck as I believe the fail CI reported is false.
On Sun, Feb 23, 2025 at 4:41 PM Ariel Otilibili <ariel.otilibili@6wind.com>
wrote:
> rte_pcapng_close() might dereference a null pointer; as example,
> PVS-Studio gives its usage in test_pcapng.c: indeed, that call to
> rte_pcapng_close() might receive a null pointer.
>
> In that case, rte_errno is set to EINVAL. The API is updated accordingly.
>
> Link: https://pvs-studio.com/en/docs/warnings/v522/
> Link:
> https://github.com/DPDK/dpdk/blob/e5176f23ae8b31437c3e5eb875c81f95bf3a9942/app/test/test_pcapng.c#L438
> Fixes: 8d23ce8f5ee9 ("pcapng: add new library for writing pcapng files")
> Signed-off-by: Ariel Otilibili <ariel.otilibili@6wind.com>
> ---
> .mailmap | 2 +-
> lib/pcapng/rte_pcapng.c | 3 +++
> lib/pcapng/rte_pcapng.h | 2 ++
> 3 files changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/.mailmap b/.mailmap
> index a03d3cfb591b..ea68d6180ccc 100644
> --- a/.mailmap
> +++ b/.mailmap
> @@ -135,7 +135,7 @@ Anupam Kapoor <anupam.kapoor@gmail.com>
> Apeksha Gupta <apeksha.gupta@nxp.com>
> Archana Muniganti <marchana@marvell.com> <
> muniganti.archana@caviumnetworks.com>
> Archit Pandey <architpandeynitk@gmail.com>
> -Ariel Otilibili <otilibil@eurecom.fr> <ariel.otilibili@6wind.com>
> +Ariel Otilibili <ariel.otilibili@6wind.com> <otilibil@eurecom.fr>
> Arkadiusz Kubalewski <arkadiusz.kubalewski@intel.com>
> Arkadiusz Kusztal <arkadiuszx.kusztal@intel.com>
> Arnaud Fiorini <arnaud.fiorini@polymtl.ca>
> diff --git a/lib/pcapng/rte_pcapng.c b/lib/pcapng/rte_pcapng.c
> index 16485b27cb46..d2cbcea42885 100644
> --- a/lib/pcapng/rte_pcapng.c
> +++ b/lib/pcapng/rte_pcapng.c
> @@ -716,6 +716,9 @@ rte_pcapng_fdopen(int fd,
> void
> rte_pcapng_close(rte_pcapng_t *self)
> {
> + if (!self)
> + rte_errno = EINVAL;
> +
> close(self->outfd);
> free(self);
> }
> diff --git a/lib/pcapng/rte_pcapng.h b/lib/pcapng/rte_pcapng.h
> index 48f2b5756430..f7b976987320 100644
> --- a/lib/pcapng/rte_pcapng.h
> +++ b/lib/pcapng/rte_pcapng.h
> @@ -60,6 +60,8 @@ rte_pcapng_fdopen(int fd,
> *
> * @param self
> * handle to library
> +
> + * If self is NULL, rte_errno is set to EINVAL.
> */
> void
> rte_pcapng_close(rte_pcapng_t *self);
> --
> 2.30.2
>
>
[-- Attachment #2: Type: text/html, Size: 4055 bytes --]
next prev parent reply other threads:[~2025-02-25 20:42 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-16 16:08 [PATCH 0/1] pcapng: fix null dereference in rte_pcapng_close Ariel Otilibili
2025-02-16 16:08 ` [PATCH 1/1] " Ariel Otilibili
2025-02-16 16:51 ` Stephen Hemminger
2025-02-23 21:41 ` [PATCH v2 0/1] warn if NULL is passed to rte_pcapng_close Ariel Otilibili
2025-02-23 21:41 ` [PATCH v2 1/1] pcapng: " Ariel Otilibili
2025-02-23 22:04 ` Dmitry Kozlyuk
2025-02-24 15:42 ` Stephen Hemminger
2025-02-24 16:42 ` Ariel Otilibili
2025-02-25 20:39 ` Patrick Robb [this message]
2025-02-24 16:40 ` [PATCH v3 0/1] pcapng: fix null dereference in rte_pcapng_close Ariel Otilibili
2025-02-24 16:40 ` [PATCH v3 1/1] " Ariel Otilibili
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=CAJvnSUCTKvqKFXGKtsgb8Fu1sk5s4UYzKMGw3YF-u1fq3fGOQw@mail.gmail.com \
--to=probb@iol.unh.edu \
--cc=ariel.otilibili@6wind.com \
--cc=dev@dpdk.org \
/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).