From patchwork Fri Jul 24 13:25:50 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Holmes X-Patchwork-Id: 51444 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f199.google.com (mail-wi0-f199.google.com [209.85.212.199]) by patches.linaro.org (Postfix) with ESMTPS id 7D63720323 for ; Fri, 24 Jul 2015 13:26:46 +0000 (UTC) Received: by wilm20 with SMTP id m20sf6825732wil.2 for ; Fri, 24 Jul 2015 06:26:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:delivered-to:from:to:date :message-id:subject:precedence:list-id:list-unsubscribe:list-archive :list-post:list-help:list-subscribe:mime-version:content-type :content-transfer-encoding:errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=DPa15kazGQpmSPo2QHlqtB1aAGdsBApnIfqx499HiVU=; b=XuKI3fB2ue1Autss1VB3TlngZ/PeXhdrTE7VRkt+90Yftx6eZ69zU5EFBulHZlrxQ1 0mOnrVZkzrc9mnmrdTcR+i9eRM5RHcnlPNR+w5ZrXl2j/PSO4SeagzS5U/KgwEmwwUo7 t3DBDpojBH8/wzpkln8MBhcHSd2z8pDTYnJWUEvQ/e6NNIlQwpwoYr/1uQfs03vIGaRl QmkhORns9QjRKC3wlzAk4Xag0oFxuplXFQsKvw1EdPHRGnSDMudyctGFU9/ZBz8ec4T0 cTbvMTjUCrDcWxSSUG4CExgwx8QXF+qmPDYvvSb5vP5Iy4EYqukiwCG55DRiaETnKWnZ klbA== X-Gm-Message-State: ALoCoQkum328bwH0y59ns++qQhw+vpbKpuT29nmG0KvGxlvnouQ6KUHQsAJceOoS/7R9dz/sN5VL X-Received: by 10.194.60.73 with SMTP id f9mr6213988wjr.6.1437744405782; Fri, 24 Jul 2015 06:26:45 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.163.65 with SMTP id yg1ls348335lab.26.gmail; Fri, 24 Jul 2015 06:26:45 -0700 (PDT) X-Received: by 10.152.5.65 with SMTP id q1mr13698951laq.110.1437744405486; Fri, 24 Jul 2015 06:26:45 -0700 (PDT) Received: from mail-la0-f50.google.com (mail-la0-f50.google.com. [209.85.215.50]) by mx.google.com with ESMTPS id tw3si7534476lbb.88.2015.07.24.06.26.45 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 24 Jul 2015 06:26:45 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.50 as permitted sender) client-ip=209.85.215.50; Received: by lafd3 with SMTP id d3so3793075laf.1 for ; Fri, 24 Jul 2015 06:26:45 -0700 (PDT) X-Received: by 10.152.120.135 with SMTP id lc7mr13399844lab.41.1437744405354; Fri, 24 Jul 2015 06:26:45 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.7.198 with SMTP id l6csp1183233lba; Fri, 24 Jul 2015 06:26:44 -0700 (PDT) X-Received: by 10.140.40.168 with SMTP id x37mr20111741qgx.24.1437744404035; Fri, 24 Jul 2015 06:26:44 -0700 (PDT) Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id t19si9997857qge.112.2015.07.24.06.26.42; Fri, 24 Jul 2015 06:26:44 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Received: by lists.linaro.org (Postfix, from userid 109) id CA35361B57; Fri, 24 Jul 2015 13:26:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from ip-10-142-244-252.ec2.internal (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id B5FF361845; Fri, 24 Jul 2015 13:26:38 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id CC35A61B1D; Fri, 24 Jul 2015 13:26:32 +0000 (UTC) Received: from mail-qk0-f171.google.com (mail-qk0-f171.google.com [209.85.220.171]) by lists.linaro.org (Postfix) with ESMTPS id 7B1F761B42 for ; Fri, 24 Jul 2015 13:25:56 +0000 (UTC) Received: by qkbm65 with SMTP id m65so13948677qkb.2 for ; Fri, 24 Jul 2015 06:25:56 -0700 (PDT) X-Received: by 10.140.23.147 with SMTP id 19mr20030888qgp.84.1437744356264; Fri, 24 Jul 2015 06:25:56 -0700 (PDT) Received: from localhost.localdomain (c-98-221-136-245.hsd1.nj.comcast.net. [98.221.136.245]) by smtp.gmail.com with ESMTPSA id p74sm4048239qkp.11.2015.07.24.06.25.55 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 24 Jul 2015 06:25:55 -0700 (PDT) From: Mike Holmes To: lng-odp@lists.linaro.org Date: Fri, 24 Jul 2015 09:25:50 -0400 Message-Id: <1437744350-2732-1-git-send-email-mike.holmes@linaro.org> X-Mailer: git-send-email 2.1.4 X-Topics: patch Subject: [lng-odp] [PATCH] helper: test: chksum: catch errors in scan_ip X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: mike.holmes@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.50 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 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 Reviewed-by: Bill Fischofer --- helper/test/odp_chksum.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/helper/test/odp_chksum.c b/helper/test/odp_chksum.c index dfd578f..1d417a8 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);