DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] examples/l2fwd-crypto: fix overflow
@ 2017-02-07 14:17 Pablo de Lara
  2017-02-09 18:24 ` Zhang, Roy Fan
  0 siblings, 1 reply; 3+ messages in thread
From: Pablo de Lara @ 2017-02-07 14:17 UTC (permalink / raw)
  To: declan.doherty; +Cc: dev, Pablo de Lara

This commit fixes an array overflow when number of crypto devices
is higher than 32.

Fixes: 387259bd6c67 ("examples/l2fwd-crypto: add sample application")

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
---
 examples/l2fwd-crypto/main.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/examples/l2fwd-crypto/main.c b/examples/l2fwd-crypto/main.c
index 43fef59..bc88be5 100644
--- a/examples/l2fwd-crypto/main.c
+++ b/examples/l2fwd-crypto/main.c
@@ -200,7 +200,7 @@ struct lcore_queue_conf {
 	unsigned nb_crypto_devs;
 	unsigned cryptodev_list[MAX_RX_QUEUE_PER_LCORE];
 
-	struct op_buffer op_buf[RTE_MAX_ETHPORTS];
+	struct op_buffer op_buf[RTE_CRYPTO_MAX_DEVS];
 	struct pkt_buffer pkt_buf[RTE_MAX_ETHPORTS];
 } __rte_cache_aligned;
 
@@ -299,7 +299,7 @@ print_stats(void)
 
 	for (cdevid = 0; cdevid < RTE_CRYPTO_MAX_DEVS; cdevid++) {
 		/* skip disabled ports */
-		if ((l2fwd_enabled_crypto_mask & (1lu << cdevid)) == 0)
+		if ((l2fwd_enabled_crypto_mask & (((uint64_t)1) << cdevid)) == 0)
 			continue;
 		printf("\nStatistics for cryptodev %"PRIu64
 				" -------------------------"
@@ -1808,7 +1808,7 @@ initialize_cryptodevs(struct l2fwd_crypto_options *options, unsigned nb_ports,
 			return -1;
 		}
 
-		l2fwd_enabled_crypto_mask |= (1 << cdev_id);
+		l2fwd_enabled_crypto_mask |= (((uint64_t)1) << cdev_id);
 
 		enabled_cdevs[cdev_id] = 1;
 		enabled_cdev_count++;
-- 
2.7.4

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH] examples/l2fwd-crypto: fix overflow
  2017-02-07 14:17 [dpdk-dev] [PATCH] examples/l2fwd-crypto: fix overflow Pablo de Lara
@ 2017-02-09 18:24 ` Zhang, Roy Fan
  2017-02-10  0:37   ` De Lara Guarch, Pablo
  0 siblings, 1 reply; 3+ messages in thread
From: Zhang, Roy Fan @ 2017-02-09 18:24 UTC (permalink / raw)
  To: Pablo de Lara, declan.doherty; +Cc: dev



On 07/02/2017 14:17, Pablo de Lara wrote:
> This commit fixes an array overflow when number of crypto devices
> is higher than 32.
>
> Fixes: 387259bd6c67 ("examples/l2fwd-crypto: add sample application")
>
> Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
>
Acked-by : Fan Zhang<roy.fan.zhang@intel.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH] examples/l2fwd-crypto: fix overflow
  2017-02-09 18:24 ` Zhang, Roy Fan
@ 2017-02-10  0:37   ` De Lara Guarch, Pablo
  0 siblings, 0 replies; 3+ messages in thread
From: De Lara Guarch, Pablo @ 2017-02-10  0:37 UTC (permalink / raw)
  To: Zhang, Roy Fan, Doherty, Declan; +Cc: dev



> -----Original Message-----
> From: Zhang, Roy Fan
> Sent: Thursday, February 09, 2017 6:24 PM
> To: De Lara Guarch, Pablo; Doherty, Declan
> Cc: dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH] examples/l2fwd-crypto: fix overflow
> 
> 
> 
> On 07/02/2017 14:17, Pablo de Lara wrote:
> > This commit fixes an array overflow when number of crypto devices
> > is higher than 32.
> >
> > Fixes: 387259bd6c67 ("examples/l2fwd-crypto: add sample application")
> >
> > Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
> >
> Acked-by : Fan Zhang<roy.fan.zhang@intel.com>

Applied to dpdk-next-crypto.

Pablo

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-02-10  0:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-07 14:17 [dpdk-dev] [PATCH] examples/l2fwd-crypto: fix overflow Pablo de Lara
2017-02-09 18:24 ` Zhang, Roy Fan
2017-02-10  0:37   ` De Lara Guarch, Pablo

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).