lib: fix shifting 32 bits signed variable 31 times
PATCH 1/3 lib: fix shifting 32 bits signed variable 31 times
Fix cppcheck warning by marking variable as unsigned.
--- lib/librte_acl/acl_gen.c | 2 +- lib/librte_net/rte_net_crc.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
lib/librte_acl/acl_gen.c +1 -1
@@ -163,7 +163,7 @@ acl_count_sequential_groups(struct rte_acl_bitset *bits, int zero_one)for (n =QRANGE_MIN ; n <UINT8_MAX +1 ; n++) {if (bits->bits[n / (sizeof (bits_t) *8 )] & - (1 << (n % (sizeof (bits_t) *8 )))) { + (1U << (n % (sizeof (bits_t) *8 )))) {if (zero_one ==1 && last_bit !=1 ) ranges++; last_bit =1 ;
lib/librte_net/rte_net_crc.c +2 -2
@@ -69,8 +69,8 @@ reflect_32bits(uint32_t val)uint32_t i, res =0 ;for (i =0 ; i <32 ; i++) -if ((val & (1 << i)) !=0 ) - res |= (uint32_t )(1 << (31 - i)); +if ((val & (1U << i)) !=0 ) + res |= (uint32_t )(1U << (31 - i));return res; }
Signature · 1 line
2.17.2
PATCH 2/3 service: fix possible NULL access
--- lib/librte_eal/common/rte_service.c | 3 +++ 1 file changed, 3 insertions(+)
lib/librte_eal/common/rte_service.c +3 -0
@@ -795,6 +795,9 @@ rte_service_dump_one(FILE *f, struct rte_service_spec_impl *s,return ; } +if (f ==NULL ) +return ; + fprintf(f, " %s: stats %d\tcalls %"PRIu64"\tcycles %" PRIu64"\tavg: %"PRIu64"\n", s->spec.name, service_stats_enabled(s), s->calls,
Signature · 1 line
2.17.2
PATCH 3/3 vhost: fix possible out of bound access
In reply to Ferruh Yigit--- lib/librte_vhost/vdpa.c | 3 +++ 1 file changed, 3 insertions(+)
lib/librte_vhost/vdpa.c +3 -0
@@ -63,6 +63,9 @@ rte_vdpa_register_device(struct rte_vdpa_dev_addr *addr,break ; } +if (i ==MAX_VHOST_DEVICE ) +return -1 ; +sprintf (device_name,"vdpa-dev-%d" , i); dev =rte_zmalloc (device_name,sizeof (struct rte_vdpa_device ),RTE_CACHE_LINE_SIZE );
Signature · 1 line
2.17.2
Re: [PATCH 2/3] service: fix possible NULL access
In reply to Ferruh YigitQuoted 7 lines
-----Original Message-----
From: Yigit, Ferruh
Sent: Saturday, October 27, 2018 6:09 PM
To: Van Haaren, Harry <[email protected]>
Cc: [email protected]; Yigit, Ferruh <[email protected]>; [email protected]
Subject: [PATCH 2/3] service: fix possible NULL access
Quoted 5 lines
Fixes 21698354c832 ("service: introduce service cores concept")Signed-off-by Ferruh Yigit <[email protected]>---
Re: [PATCH 3/3] vhost: fix possible out of bound access
In reply to Ferruh YigitQuoted 14 lines · Ferruh Yigit
Fixes d7280c9fffcb ("vhost: support selective datapath")Signed-off-by Ferruh Yigit <[email protected]>--- lib/librte_vhost/vdpa.c | 3 +++ 1 file changed, 3 insertions(+)lib/librte_vhost/vdpa.c +0
-0
lib/librte_vhost/vdpa.c rte_vdpa_register_device(struct rte_vdpa_dev_addr *addr, · line 71
Quoted 9 lines
lib/librte_vhost/vdpa.c +3
-0@@ -63,6 +63,9 @@ rte_vdpa_register_device(struct rte_vdpa_dev_addr *addr,break ; } +if (i ==MAX_VHOST_DEVICE ) +return -1 ; +sprintf (device_name,"vdpa-dev-%d" , i); dev =rte_zmalloc (device_name,sizeof (struct rte_vdpa_device ),RTE_CACHE_LINE_SIZE );
Thanks,
Maxime
28/10/2018 02:08, Ferruh Yigit:
Quoted 7 lines
Fix cppcheck warning by marking variable as unsigned.
Fixes dc276b5780c2 ("acl: new library")Fixes 986ff526fb84 ("net: add CRC computation API")Signed-off-by Ferruh Yigit <[email protected]>
Series applied, thanks