patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Jerin Jacob <jerinjacobk@gmail.com>
To: Ankur Dwivedi <adwivedi@marvell.com>,
	Ferruh Yigit <ferruh.yigit@intel.com>
Cc: dpdk-dev <dev@dpdk.org>,
	Nithin Dabilpuram <ndabilpuram@marvell.com>,
	 Kiran Kumar K <kirankumark@marvell.com>,
	Sunil Kumar Kori <skori@marvell.com>,
	 Satha Koteswara Rao Kottidi <skoteshwar@marvell.com>,
	Jerin Jacob <jerinj@marvell.com>, dpdk stable <stable@dpdk.org>
Subject: Re: [PATCH] common/cnxk: validate length argument
Date: Thu, 17 Feb 2022 18:34:01 +0530	[thread overview]
Message-ID: <CALBAE1MvaAvq5iE2omCNJXuaZJfoDLdCVNyC+SP98xw3+zWOWQ@mail.gmail.com> (raw)
In-Reply-To: <20220207061246.4209-1-adwivedi@marvell.com>

On Mon, Feb 7, 2022 at 11:43 AM Ankur Dwivedi <adwivedi@marvell.com> wrote:
>
> The x->len is passed as argument to npc_prep_mcam_ldata(). In the
> function the len is used to reference elements of int_info and
> int_info_mask array. The arrays are of length NPC_MAX_EXTRACT_DATA_LEN.
>
> Validating the x->len value so that it is not greater than
> NPC_MAX_EXTRACT_DATA_LEN.
>
> This patch also resolves warning observed with gcc 12 compiler.
>
> log:
>    ../drivers/common/cnxk/roc_npc_utils.c:13:26: warning: writing 16 bytes
>    into a region of size 0 [-Wstringop-overflow=]
>    ptr[idx] = data[len - 1 - idx];
>
>    ../drivers/common/cnxk/roc_npc_utils.c:163:17: note: at offset 64 into
>    destination object ‘int_info’ of size 64
>    uint8_t int_info[NPC_MAX_EXTRACT_DATA_LEN];
>
> Bugzilla ID: 854
> Fixes: 665b6a7400bf ("common/cnxk: add NPC helper API")
> Cc: stable@dpdk.org
>
> Signed-off-by: Ankur Dwivedi <adwivedi@marvell.com>
> Reviewed-by: Kiran Kumar Kokkilagadda <kirankumark@marvell.com>

Changed the subject as
common/cnxk: fix NPC key extraction validation

Applied to dpdk-next-net-mrvl/for-next-net. Thanks


> ---
>  drivers/common/cnxk/roc_npc_utils.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/drivers/common/cnxk/roc_npc_utils.c b/drivers/common/cnxk/roc_npc_utils.c
> index ed0ef5c462..007c454c3c 100644
> --- a/drivers/common/cnxk/roc_npc_utils.c
> +++ b/drivers/common/cnxk/roc_npc_utils.c
> @@ -166,6 +166,9 @@ npc_update_extraction_data(struct npc_parse_state *pst,
>         int len = 0;
>
>         x = xinfo;
> +       if (x->len > NPC_MAX_EXTRACT_DATA_LEN)
> +               return NPC_ERR_INVALID_SIZE;
> +
>         len = x->len;
>         hdr_off = x->hdr_off;
>
> --
> 2.28.0
>

      reply	other threads:[~2022-02-17 13:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-07  6:12 Ankur Dwivedi
2022-02-17 13:04 ` Jerin Jacob [this message]

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=CALBAE1MvaAvq5iE2omCNJXuaZJfoDLdCVNyC+SP98xw3+zWOWQ@mail.gmail.com \
    --to=jerinjacobk@gmail.com \
    --cc=adwivedi@marvell.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=jerinj@marvell.com \
    --cc=kirankumark@marvell.com \
    --cc=ndabilpuram@marvell.com \
    --cc=skori@marvell.com \
    --cc=skoteshwar@marvell.com \
    --cc=stable@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).