[dpdk-dev] examples/exception_path: bad shift operation in setup_port_lcore_affinities

Message ID 1460734180-121811-1-git-send-email-danielx.t.mrzyglod@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers

Commit Message

Daniel Mrzyglod April 15, 2016, 3:29 p.m. UTC
  CID: #30688
The operaton may have an undefined behavior or yield to an unexpected result.

In setup_port_lcore_affinities: A bit shift operation has a shift amount which
is too large or has a negative value.

Fixes: af75078fece3 ("first public release")

Signed-off-by: Daniel Mrzyglod <danielx.t.mrzyglod@intel.com>
---
 examples/exception_path/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Thomas Monjalon April 27, 2016, 2:24 p.m. UTC | #1
2016-04-15 17:29, Daniel Mrzyglod:
> CID: #30688
> The operaton may have an undefined behavior or yield to an unexpected result.
> 
> In setup_port_lcore_affinities: A bit shift operation has a shift amount which
> is too large or has a negative value.
> 
> Fixes: af75078fece3 ("first public release")
> 
> Signed-off-by: Daniel Mrzyglod <danielx.t.mrzyglod@intel.com>

Applied, thanks
  

Patch

diff --git a/examples/exception_path/main.c b/examples/exception_path/main.c
index bec9804..c14a933 100644
--- a/examples/exception_path/main.c
+++ b/examples/exception_path/main.c
@@ -351,7 +351,7 @@  setup_port_lcore_affinities(void)
 
 			port_ids[i] = rx_port++;
 		}
-		else if (output_cores_mask & (1ULL << i)) {
+		else if (output_cores_mask & (1ULL << (i & 0x3f))) {
 			/* Skip ports that are not enabled */
 			while ((ports_mask & (1 << tx_port)) == 0) {
 				tx_port++;