net/cpfl: fix build error for debian 32-bit

Message ID 20240710145351.599031-1-bruce.richardson@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Bruce Richardson
Headers
Series net/cpfl: fix build error for debian 32-bit |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/intel-Functional success Functional PASS
ci/github-robot: build success github build: passed
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-sample-apps-testing success Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-compile-amd64-testing success Testing PASS
ci/iol-unit-amd64-testing success Testing PASS
ci/iol-unit-arm64-testing success Testing PASS
ci/iol-compile-arm64-testing success Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS

Commit Message

Bruce Richardson July 10, 2024, 2:53 p.m. UTC
When building for debian 11 32-bit, errors were reported with cpfl
driver[1]. The error is due to comparing signed and unsigned values:

../drivers/net/cpfl/cpfl_flow_parser.c:1699:29: error: comparison of
  integer expressions of different signedness: 'long int' and
  'uint32_t' {aka 'unsigned int'} [-Werror=sign-compare]

Fix the issue by using an explicitly cast for the return value from
atol.

Fixes: c10881d3ee74 ("net/cpfl: support flow prog action")
Cc: stable@dpdk.org

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>

[1] https://build.opensuse.org/package/live_build_log/home:bluca:dpdk/dpdk/Debian_11/i586
---
 drivers/net/cpfl/cpfl_flow_parser.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

David Marchand July 10, 2024, 3:07 p.m. UTC | #1
On Wed, Jul 10, 2024 at 4:54 PM Bruce Richardson
<bruce.richardson@intel.com> wrote:
>
> When building for debian 11 32-bit, errors were reported with cpfl
> driver[1]. The error is due to comparing signed and unsigned values:
>
> ../drivers/net/cpfl/cpfl_flow_parser.c:1699:29: error: comparison of
>   integer expressions of different signedness: 'long int' and
>   'uint32_t' {aka 'unsigned int'} [-Werror=sign-compare]
>
> Fix the issue by using an explicitly cast for the return value from
> atol.
>
> Fixes: c10881d3ee74 ("net/cpfl: support flow prog action")
> Cc: stable@dpdk.org
>
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
  
Bruce Richardson July 10, 2024, 4:10 p.m. UTC | #2
On Wed, Jul 10, 2024 at 05:07:30PM +0200, David Marchand wrote:
> On Wed, Jul 10, 2024 at 4:54 PM Bruce Richardson
> <bruce.richardson@intel.com> wrote:
> >
> > When building for debian 11 32-bit, errors were reported with cpfl
> > driver[1]. The error is due to comparing signed and unsigned values:
> >
> > ../drivers/net/cpfl/cpfl_flow_parser.c:1699:29: error: comparison of
> >   integer expressions of different signedness: 'long int' and
> >   'uint32_t' {aka 'unsigned int'} [-Werror=sign-compare]
> >
> > Fix the issue by using an explicitly cast for the return value from
> > atol.
> >
> > Fixes: c10881d3ee74 ("net/cpfl: support flow prog action")
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> Reviewed-by: David Marchand <david.marchand@redhat.com>
> 
Applied to dpdk-next-net-intel

/Bruce
  

Patch

diff --git a/drivers/net/cpfl/cpfl_flow_parser.c b/drivers/net/cpfl/cpfl_flow_parser.c
index a8f0488f21..40569ddc6f 100644
--- a/drivers/net/cpfl/cpfl_flow_parser.c
+++ b/drivers/net/cpfl/cpfl_flow_parser.c
@@ -1696,7 +1696,7 @@  cpfl_parse_check_prog_action(struct cpfl_flow_js_mr_key_action *key_act,
 	bool check_name;
 
 	check_name = key_act->prog.has_name ? strcmp(prog->name, key_act->prog.name) == 0
-					    : atol(prog->name) == key_act->prog.id;
+					    : (uint32_t)atol(prog->name) == key_act->prog.id;
 	if (!check_name) {
 		PMD_DRV_LOG(ERR, "Not support this prog type: %s.", prog->name);
 		return -EINVAL;