diff options
author | Mike Holmes <mike.holmes@linaro.org> | 2015-07-24 09:25:50 -0400 |
---|---|---|
committer | Maxim Uvarov <maxim.uvarov@linaro.org> | 2015-07-27 12:24:55 +0300 |
commit | f7afeec4a80c280d72a4f4d00ff051753102d5c1 (patch) | |
tree | 472b5962bd2140b40f389a3ffd8285267e36e08c /helper | |
parent | cd582949369ac9a659b133f1a3259717e4a9fa44 (diff) |
helper: test: chksum: catch errors in scan_ip
It is possible for scan_ip to return an error leaving the buf variable
pointed to undefined. Check scan_ips return code.
Signed-off-by: Mike Holmes <mike.holmes@linaro.org>
Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org>
Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
Diffstat (limited to 'helper')
-rw-r--r-- | helper/test/odp_chksum.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/helper/test/odp_chksum.c b/helper/test/odp_chksum.c index dfd578f46..1d417a881 100644 --- a/helper/test/odp_chksum.c +++ b/helper/test/odp_chksum.c @@ -157,8 +157,16 @@ int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED) memcpy((char *)eth->dst.addr, &des, ODPH_ETHADDR_LEN); eth->type = odp_cpu_to_be_16(ODPH_ETHTYPE_IPV4); - scan_ip("192.168.0.1", &dstip); - scan_ip("192.168.0.2", &srcip); + if (!scan_ip("192.168.0.1", &dstip)) { + LOG_ERR("Error: scan_ip\n"); + return -1; + } + + if (!scan_ip("192.168.0.2", &srcip)) { + LOG_ERR("Error: scan_ip\n"); + return -1; + } + /* ip */ odp_packet_l3_offset_set(test_packet, ODPH_ETHHDR_LEN); ip = (odph_ipv4hdr_t *)(buf + ODPH_ETHHDR_LEN); |