[dpdk-dev,v3,05/24] lib/librte_eal: explicit cast for signed change

Message ID 152609034736.121661.8183957126379452765.stgit@localhost.localdomain (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Andy Green May 12, 2018, 1:59 a.m. UTC
  /projects/lagopus/src/dpdk/build/include/rte_lcore.h:
In function 'rte_lcore_index':
/projects/lagopus/src/dpdk/build/include/rte_lcore.h:122:14:
warning: conversion to 'int' from 'unsigned int' may change
the sign of the result [-Wsign-conversion]
   lcore_id = rte_lcore_id();

Signed-off-by: Andy Green <andy@warmcat.com>
---
 lib/librte_eal/common/include/rte_lcore.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Thomas Monjalon May 13, 2018, 8:40 p.m. UTC | #1
12/05/2018 03:59, Andy Green:
> /projects/lagopus/src/dpdk/build/include/rte_lcore.h:
> In function 'rte_lcore_index':
> /projects/lagopus/src/dpdk/build/include/rte_lcore.h:122:14:
> warning: conversion to 'int' from 'unsigned int' may change
> the sign of the result [-Wsign-conversion]
>    lcore_id = rte_lcore_id();

    Fixes: 5583037a7950 ("eal: get relative core index")
    Cc: stable@dpdk.org

> Signed-off-by: Andy Green <andy@warmcat.com>

Applied, thanks
  

Patch

diff --git a/lib/librte_eal/common/include/rte_lcore.h b/lib/librte_eal/common/include/rte_lcore.h
index 1a2f37eaa..6e09d9181 100644
--- a/lib/librte_eal/common/include/rte_lcore.h
+++ b/lib/librte_eal/common/include/rte_lcore.h
@@ -119,7 +119,7 @@  rte_lcore_index(int lcore_id)
 	if (lcore_id >= RTE_MAX_LCORE)
 		return -1;
 	if (lcore_id < 0)
-		lcore_id = rte_lcore_id();
+		lcore_id = (int)rte_lcore_id();
 	return lcore_config[lcore_id].core_index;
 }