DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Zhang, Roy Fan" <roy.fan.zhang@intel.com>
To: "Power, Ciara" <ciara.power@intel.com>, "dev@dpdk.org" <dev@dpdk.org>
Cc: "gakhil@marvell.com" <gakhil@marvell.com>,
	"Kusztal, ArkadiuszX" <arkadiuszx.kusztal@intel.com>
Subject: RE: [PATCH] crypto: fix asymmetric private session variable size
Date: Fri, 18 Feb 2022 14:08:17 +0000	[thread overview]
Message-ID: <MW5PR11MB58096C78E1DB7752E56E7CBCB8379@MW5PR11MB5809.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20220218125752.579335-1-ciara.power@intel.com>

> -----Original Message-----
> From: Power, Ciara <ciara.power@intel.com>
> Sent: Friday, February 18, 2022 12:58 PM
> To: dev@dpdk.org
> Cc: Zhang, Roy Fan <roy.fan.zhang@intel.com>; gakhil@marvell.com; Kusztal,
> ArkadiuszX <arkadiuszx.kusztal@intel.com>; Power, Ciara
> <ciara.power@intel.com>
> Subject: [PATCH] crypto: fix asymmetric private session variable size
> 
> When creating the asymmetric session mempool, the maximum private
> session size of all devices is used when creating the mempool
> object size.
> The return value for ``rte_cryptodev_asym_get_private_session_size``
> is unsigned int, whereas the variable was uint8_t, leading to a
> possible overflow issue.
> 
> To fix this, the variable for private session size is now changed to
> unsigned int to match the function return type.
> 
> Fixes: 1f1e4b7cbaad ("cryptodev: use single mempool for asymmetric
> session")
> Reported-by: Arek Kusztal <arkadiuszx.kusztal@intel.com>
> 
> Signed-off-by: Ciara Power <ciara.power@intel.com>
> ---
>  lib/cryptodev/rte_cryptodev.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/cryptodev/rte_cryptodev.c b/lib/cryptodev/rte_cryptodev.c
> index 727d271fb9..d262ae6ffa 100644
> --- a/lib/cryptodev/rte_cryptodev.c
> +++ b/lib/cryptodev/rte_cryptodev.c
> @@ -1810,7 +1810,8 @@ rte_cryptodev_asym_session_pool_create(const
> char *name, uint32_t nb_elts,
>  	struct rte_mempool *mp;
>  	struct rte_cryptodev_asym_session_pool_private_data *pool_priv;
>  	uint32_t obj_sz, obj_sz_aligned;
> -	uint8_t dev_id, priv_sz, max_priv_sz = 0;
> +	uint8_t dev_id;
> +	unsigned int priv_sz, max_priv_sz = 0;
> 
>  	for (dev_id = 0; dev_id < RTE_CRYPTO_MAX_DEVS; dev_id++)
>  		if (rte_cryptodev_is_valid_dev(dev_id)) {
> --
> 2.25.1
Looks like the variable type of unsigned int is match the return type. So
Acked-by: Fan Zhang <roy.fan.zhang@intel.com>


  parent reply	other threads:[~2022-02-18 14:08 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-18 12:57 Ciara Power
2022-02-18 13:39 ` Zhang, Roy Fan
2022-02-18 14:08 ` Zhang, Roy Fan [this message]
2022-02-21 10:38   ` Kusztal, ArkadiuszX
2022-02-22 19:02     ` Akhil Goyal

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=MW5PR11MB58096C78E1DB7752E56E7CBCB8379@MW5PR11MB5809.namprd11.prod.outlook.com \
    --to=roy.fan.zhang@intel.com \
    --cc=arkadiuszx.kusztal@intel.com \
    --cc=ciara.power@intel.com \
    --cc=dev@dpdk.org \
    --cc=gakhil@marvell.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).