DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] examples/l2fwd: check if user portmask is valid
@ 2018-02-01 18:51 Vipin Varghese
  2018-02-01 18:58 ` [dpdk-dev] [PATCH v2] " Vipin Varghese
  0 siblings, 1 reply; 4+ messages in thread
From: Vipin Varghese @ 2018-02-01 18:51 UTC (permalink / raw)
  To: dev; +Cc: stable, pablo.de.lara.guarch, bruce.richardson, Vipin Varghese

User can pass portmask with any value, even invalid mask. The code
checks against actual portmask.

Signed-off-by: Vipin Varghese <vipin.varghese@intel.com>
---
 examples/l2fwd/main.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/examples/l2fwd/main.c b/examples/l2fwd/main.c
index 6c07ed4..1c02c1b 100644
--- a/examples/l2fwd/main.c
+++ b/examples/l2fwd/main.c
@@ -549,6 +549,11 @@ enum {
 	if (nb_ports == 0)
 		rte_exit(EXIT_FAILURE, "No Ethernet ports - bye\n");
 
+	/* icheck port mask to possible port mask */
+	if (l2fwd_enabled_port_mask & ~((1 << nb_ports) - 1))
+		rte_exit(EXIT_FAILURE, "Invalid portmask; possible (0x%x)\n",
+			(1 << nb_ports) - 1);
+
 	/* reset l2fwd_dst_ports */
 	for (portid = 0; portid < RTE_MAX_ETHPORTS; portid++)
 		l2fwd_dst_ports[portid] = 0;
-- 
1.9.1

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

* [dpdk-dev] [PATCH v2] examples/l2fwd: check if user portmask is valid
  2018-02-01 18:51 [dpdk-dev] [PATCH] examples/l2fwd: check if user portmask is valid Vipin Varghese
@ 2018-02-01 18:58 ` Vipin Varghese
  2018-02-06 16:55   ` De Lara Guarch, Pablo
  0 siblings, 1 reply; 4+ messages in thread
From: Vipin Varghese @ 2018-02-01 18:58 UTC (permalink / raw)
  To: dev; +Cc: stable, pablo.de.lara.guarch, bruce.richardson, Vipin Varghese

User can pass portmask with any value, even invalid mask. The code
checks against actual portmask.

Signed-off-by: Vipin Varghese <vipin.varghese@intel.com>
---

V2 Changes:
 - correct the spelling in comment - Vipin
---
 examples/l2fwd/main.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/examples/l2fwd/main.c b/examples/l2fwd/main.c
index 6c07ed4..e4a4a7c 100644
--- a/examples/l2fwd/main.c
+++ b/examples/l2fwd/main.c
@@ -549,6 +549,11 @@ enum {
 	if (nb_ports == 0)
 		rte_exit(EXIT_FAILURE, "No Ethernet ports - bye\n");
 
+	/* check port mask to possible port mask */
+	if (l2fwd_enabled_port_mask & ~((1 << nb_ports) - 1))
+		rte_exit(EXIT_FAILURE, "Invalid portmask; possible (0x%x)\n",
+			(1 << nb_ports) - 1);
+
 	/* reset l2fwd_dst_ports */
 	for (portid = 0; portid < RTE_MAX_ETHPORTS; portid++)
 		l2fwd_dst_ports[portid] = 0;
-- 
1.9.1

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

* Re: [dpdk-dev] [PATCH v2] examples/l2fwd: check if user portmask is valid
  2018-02-01 18:58 ` [dpdk-dev] [PATCH v2] " Vipin Varghese
@ 2018-02-06 16:55   ` De Lara Guarch, Pablo
  2018-02-06 17:53     ` Thomas Monjalon
  0 siblings, 1 reply; 4+ messages in thread
From: De Lara Guarch, Pablo @ 2018-02-06 16:55 UTC (permalink / raw)
  To: Varghese, Vipin, dev; +Cc: Richardson, Bruce



> -----Original Message-----
> From: Varghese, Vipin
> Sent: Thursday, February 1, 2018 6:59 PM
> To: dev@dpdk.org
> Cc: stable@dpdk.org; De Lara Guarch, Pablo
> <pablo.de.lara.guarch@intel.com>; Richardson, Bruce
> <bruce.richardson@intel.com>; Varghese, Vipin
> <vipin.varghese@intel.com>
> Subject: [PATCH v2] examples/l2fwd: check if user portmask is valid
> 
> User can pass portmask with any value, even invalid mask. The code checks
> against actual portmask.
> 
> Signed-off-by: Vipin Varghese <vipin.varghese@intel.com>
> ---
> 
> V2 Changes:
>  - correct the spelling in comment - Vipin

I think there is no need to CC stable here, so I will remove it from the list.

Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>

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

* Re: [dpdk-dev] [PATCH v2] examples/l2fwd: check if user portmask is valid
  2018-02-06 16:55   ` De Lara Guarch, Pablo
@ 2018-02-06 17:53     ` Thomas Monjalon
  0 siblings, 0 replies; 4+ messages in thread
From: Thomas Monjalon @ 2018-02-06 17:53 UTC (permalink / raw)
  To: Varghese, Vipin; +Cc: dev, De Lara Guarch, Pablo, Richardson, Bruce

> > User can pass portmask with any value, even invalid mask. The code checks
> > against actual portmask.
> > 
> > Signed-off-by: Vipin Varghese <vipin.varghese@intel.com>
> > ---
> > 
> > V2 Changes:
> >  - correct the spelling in comment - Vipin
> 
> I think there is no need to CC stable here, so I will remove it from the list.
> 
> Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>

Applied, thanks

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

end of thread, other threads:[~2018-02-06 17:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-01 18:51 [dpdk-dev] [PATCH] examples/l2fwd: check if user portmask is valid Vipin Varghese
2018-02-01 18:58 ` [dpdk-dev] [PATCH v2] " Vipin Varghese
2018-02-06 16:55   ` De Lara Guarch, Pablo
2018-02-06 17:53     ` Thomas Monjalon

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