Message ID | 1482327511-18414-1-git-send-email-maxim.uvarov@linaro.org |
---|---|
State | Accepted |
Commit | 92ae191876c39a3f5d4fba63e58dd9e8c444239b |
Headers | show |
On 21 December 2016 at 08:38, Maxim Uvarov <maxim.uvarov@linaro.org> wrote: > get_unique_id() function on error do not update it's second and > third arguments (unique_id and is_ipv4). gcc -O3 finds that > and traps compilation. > > Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org> > Tested-and-reviewed-by: Mike Holmes <mike.holmes@linaro.org> Fixes traffic_mngr.c: In function ‘dump_rcvd_pkts.constprop’: traffic_mngr.c:948:18: error: ‘is_ipv4’ may be used uninitialized in this function [-Werror=maybe-uninitialized] uint8_t is_ipv4; ^~~~~~~ traffic_mngr.c:959:3: error: ‘unique_id’ may be used uninitialized in this function [-Werror=maybe-uninitialized] printf("rcv_idx=%" PRIu32 " odp_pkt=0x%" PRIX64 " " ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "xmt_idx=%" PRId32 " pkt_class=%u is_ipv4=%u " ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "unique_id=0x%X (rc=%d)\n", ~~~~~~~~~~~~~~~~~~~~~~~~~~~ rcv_idx, odp_packet_to_u64(rcv_pkt), xmt_idx, ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ rcv_pkt_desc->pkt_class, is_ipv4, unique_id, rc); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ cc1: all warnings being treated as errors > --- > test/common_plat/validation/api/traffic_mngr/traffic_mngr.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/test/common_plat/validation/api/traffic_mngr/traffic_mngr.c > b/test/common_plat/validation/api/traffic_mngr/traffic_mngr.c > index fcc7187..0271758 100644 > --- a/test/common_plat/validation/api/traffic_mngr/traffic_mngr.c > +++ b/test/common_plat/validation/api/traffic_mngr/traffic_mngr.c > @@ -944,8 +944,8 @@ static void dump_rcvd_pkts(uint32_t first_rcv_idx, > uint32_t last_rcv_idx) > odp_packet_t rcv_pkt; > uint32_t rcv_idx; > int32_t xmt_idx; > - uint16_t unique_id; > - uint8_t is_ipv4; > + uint16_t unique_id = 0; > + uint8_t is_ipv4 = 0; > int rc; > > for (rcv_idx = first_rcv_idx; rcv_idx <= last_rcv_idx; rcv_idx++) { > -- > 2.7.1.250.gff4ea60 > > -- Mike Holmes Program Manager - Linaro Networking Group Linaro.org <http://www.linaro.org/> *│ *Open source software for ARM SoCs "Work should be fun and collaborative, the rest follows"
Merged, Maxim. On 12/21/16 17:40, Mike Holmes wrote: > > > On 21 December 2016 at 08:38, Maxim Uvarov <maxim.uvarov@linaro.org > <mailto:maxim.uvarov@linaro.org>> wrote: > > get_unique_id() function on error do not update it's second and > third arguments (unique_id and is_ipv4). gcc -O3 finds that > and traps compilation. > > Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org > <mailto:maxim.uvarov@linaro.org>> > > > Tested-and-reviewed-by: Mike Holmes <mike.holmes@linaro.org> > > Fixes > traffic_mngr.c: In function ‘dump_rcvd_pkts.constprop’: > traffic_mngr.c:948:18: error: ‘is_ipv4’ may be used uninitialized in > this function [-Werror=maybe-uninitialized] > uint8_t is_ipv4; > ^~~~~~~ > traffic_mngr.c:959:3: error: ‘unique_id’ may be used uninitialized in > this function [-Werror=maybe-uninitialized] > printf("rcv_idx=%" PRIu32 " odp_pkt=0x%" PRIX64 " " > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > "xmt_idx=%" PRId32 " pkt_class=%u is_ipv4=%u " > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > "unique_id=0x%X (rc=%d)\n", > ~~~~~~~~~~~~~~~~~~~~~~~~~~~ > rcv_idx, odp_packet_to_u64(rcv_pkt), xmt_idx, > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > rcv_pkt_desc->pkt_class, is_ipv4, unique_id, rc); > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > cc1: all warnings being treated as errors > > > > > --- > test/common_plat/validation/api/traffic_mngr/traffic_mngr.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git > a/test/common_plat/validation/api/traffic_mngr/traffic_mngr.c > b/test/common_plat/validation/api/traffic_mngr/traffic_mngr.c > index fcc7187..0271758 100644 > --- a/test/common_plat/validation/api/traffic_mngr/traffic_mngr.c > +++ b/test/common_plat/validation/api/traffic_mngr/traffic_mngr.c > @@ -944,8 +944,8 @@ static void dump_rcvd_pkts(uint32_t > first_rcv_idx, uint32_t last_rcv_idx) > odp_packet_t rcv_pkt; > uint32_t rcv_idx; > int32_t xmt_idx; > - uint16_t unique_id; > - uint8_t is_ipv4; > + uint16_t unique_id = 0; > + uint8_t is_ipv4 = 0; > int rc; > > for (rcv_idx = first_rcv_idx; rcv_idx <= last_rcv_idx; > rcv_idx++) { > -- > 2.7.1.250.gff4ea60 > > > > > -- > Mike Holmes > Program Manager - Linaro Networking Group > Linaro.org <http://www.linaro.org/>* **│ *Open source software for ARM SoCs > "Work should be fun and collaborative, the rest follows" > > __ > >
diff --git a/test/common_plat/validation/api/traffic_mngr/traffic_mngr.c b/test/common_plat/validation/api/traffic_mngr/traffic_mngr.c index fcc7187..0271758 100644 --- a/test/common_plat/validation/api/traffic_mngr/traffic_mngr.c +++ b/test/common_plat/validation/api/traffic_mngr/traffic_mngr.c @@ -944,8 +944,8 @@ static void dump_rcvd_pkts(uint32_t first_rcv_idx, uint32_t last_rcv_idx) odp_packet_t rcv_pkt; uint32_t rcv_idx; int32_t xmt_idx; - uint16_t unique_id; - uint8_t is_ipv4; + uint16_t unique_id = 0; + uint8_t is_ipv4 = 0; int rc; for (rcv_idx = first_rcv_idx; rcv_idx <= last_rcv_idx; rcv_idx++) {
get_unique_id() function on error do not update it's second and third arguments (unique_id and is_ipv4). gcc -O3 finds that and traps compilation. Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org> --- test/common_plat/validation/api/traffic_mngr/traffic_mngr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.7.1.250.gff4ea60