From patchwork Mon Jun 2 17:10:01 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stuart Haslam X-Patchwork-Id: 31299 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vc0-f199.google.com (mail-vc0-f199.google.com [209.85.220.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id B09DC203C2 for ; Mon, 2 Jun 2014 17:10:44 +0000 (UTC) Received: by mail-vc0-f199.google.com with SMTP id id10sf22035002vcb.6 for ; Mon, 02 Jun 2014 10:10:44 -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:from:to:date:message-id:in-reply-to :references:subject:precedence:list-id:list-unsubscribe:list-archive :list-post:list-help:list-subscribe:mime-version:errors-to:sender :x-original-sender:x-original-authentication-results:mailing-list :content-type:content-transfer-encoding; bh=tqh9Axo7hIBMwxLpSc59X2B6sbCkjvFwKUibtH0FthQ=; b=PbsCweX8E7GEqkHZZSsQvI4nT/pknyD8O9rrYFc72zxAAjtk/yhqk0tBGpcCCEsAF+ G2NtAwCX//HfO0vuFWOodmDFsPkWeYYiYLlxqJBFUUPBm2VyF1Gd7LYnxA3MUc/NXFmy doAqcsCQUR6SWwrz86NIqYYMH+FjBTITO0F3A8u7aCTAFlNmyciu/lIVONh7oq5oucvx ppdk3mYINAZB1w73O1A9Bvq0ZaoVYJWZIcxfykuO6F9QES9mn9MmbzbSePaWjHpCBcsI 9zX/ZoSjFYlCFJbD/DBQVptTe86opqUgesPG8PcRl2SpXxxGYpM3BnQw6qZ8xmI+dbkK NtGQ== X-Gm-Message-State: ALoCoQmopZsoinZapNuspDBWbqcSF/m2DruKo1kJivUlK6f/oCzG8VRdKBBkeemc3LqdCrXSjvG4 X-Received: by 10.58.106.75 with SMTP id gs11mr15116254veb.18.1401729044490; Mon, 02 Jun 2014 10:10:44 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.105.54 with SMTP id b51ls2144609qgf.48.gmail; Mon, 02 Jun 2014 10:10:44 -0700 (PDT) X-Received: by 10.52.227.138 with SMTP id sa10mr26375825vdc.25.1401729044327; Mon, 02 Jun 2014 10:10:44 -0700 (PDT) Received: from mail-vc0-f169.google.com (mail-vc0-f169.google.com [209.85.220.169]) by mx.google.com with ESMTPS id yh1si8263180vec.100.2014.06.02.10.10.44 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 02 Jun 2014 10:10:44 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.169 as permitted sender) client-ip=209.85.220.169; Received: by mail-vc0-f169.google.com with SMTP id il7so1733246vcb.14 for ; Mon, 02 Jun 2014 10:10:44 -0700 (PDT) X-Received: by 10.58.2.74 with SMTP id 10mr1781364ves.61.1401729044253; Mon, 02 Jun 2014 10:10:44 -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.220.221.72 with SMTP id ib8csp113229vcb; Mon, 2 Jun 2014 10:10:43 -0700 (PDT) X-Received: by 10.140.47.18 with SMTP id l18mr48879115qga.9.1401729043836; Mon, 02 Jun 2014 10:10:43 -0700 (PDT) Received: from ip-10-141-164-156.ec2.internal (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTPS id d4si18323884qge.70.2014.06.02.10.10.43 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 02 Jun 2014 10:10:43 -0700 (PDT) Received-SPF: none (google.com: lng-odp-bounces@lists.linaro.org does not designate permitted sender hosts) client-ip=54.225.227.206; Received: from localhost ([127.0.0.1] helo=ip-10-141-164-156.ec2.internal) by ip-10-141-164-156.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1WrVje-0002Pc-Hp; Mon, 02 Jun 2014 17:09:22 +0000 Received: from service87.mimecast.com ([91.220.42.44]) by ip-10-141-164-156.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1WrVjS-0002Ov-Gy for lng-odp@lists.linaro.org; Mon, 02 Jun 2014 17:09:10 +0000 Received: from cam-owa1.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.21]) by service87.mimecast.com; Mon, 02 Jun 2014 18:10:29 +0100 Received: from e106441.cambridge.arm.com ([10.1.255.212]) by cam-owa1.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.3959); Mon, 2 Jun 2014 18:10:27 +0100 From: Stuart Haslam To: lng-odp@lists.linaro.org Date: Mon, 2 Jun 2014 18:10:01 +0100 Message-Id: <1401729001-15729-3-git-send-email-stuart.haslam@arm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1401729001-15729-1-git-send-email-stuart.haslam@arm.com> References: <1401729001-15729-1-git-send-email-stuart.haslam@arm.com> X-OriginalArrivalTime: 02 Jun 2014 17:10:27.0480 (UTC) FILETIME=[8CC98180:01CF7E85] X-MC-Unique: 114060218102905901 X-Topics: patch Subject: [lng-odp] [PATCH 2/2] Fix mismatched size of ODP_PACKET_OFFSET_INVALID X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.14 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-bounces@lists.linaro.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: stuart.haslam@arm.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.169 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 ODP_PACKET_OFFSET_INVALID is defined as ((size_t)-1) but the existing implementations both store offsets using a uint32_t, which breaks things in a few places on 64-bit systems. There's some explicit casting in the implementations but it's not consistent and the odp_packet_l2/3/4 functions can return a junk ptr if packet parsing didn't get far enough to set the offset correctly. Signed-off-by: Stuart Haslam --- include/odp_packet.h | 2 +- platform/linux-generic/source/odp_packet.c | 6 +++--- platform/linux-keystone2/source/odp_packet.c | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/include/odp_packet.h b/include/odp_packet.h index f7014fb..932b009 100644 --- a/include/odp_packet.h +++ b/include/odp_packet.h @@ -30,7 +30,7 @@ typedef uint32_t odp_packet_t; #define ODP_PACKET_INVALID ODP_BUFFER_INVALID /** Invalid offset */ -#define ODP_PACKET_OFFSET_INVALID ((size_t)-1) +#define ODP_PACKET_OFFSET_INVALID ((uint32_t)-1) /** diff --git a/platform/linux-generic/source/odp_packet.c b/platform/linux-generic/source/odp_packet.c index eb7c227..530e513 100644 --- a/platform/linux-generic/source/odp_packet.c +++ b/platform/linux-generic/source/odp_packet.c @@ -31,9 +31,9 @@ void odp_packet_init(odp_packet_t pkt) len = ODP_OFFSETOF(odp_packet_hdr_t, payload) - start_offset; memset(start, 0, len); - pkt_hdr->l2_offset = (uint32_t) ODP_PACKET_OFFSET_INVALID; - pkt_hdr->l3_offset = (uint32_t) ODP_PACKET_OFFSET_INVALID; - pkt_hdr->l4_offset = (uint32_t) ODP_PACKET_OFFSET_INVALID; + pkt_hdr->l2_offset = ODP_PACKET_OFFSET_INVALID; + pkt_hdr->l3_offset = ODP_PACKET_OFFSET_INVALID; + pkt_hdr->l4_offset = ODP_PACKET_OFFSET_INVALID; } odp_packet_t odp_packet_from_buffer(odp_buffer_t buf) diff --git a/platform/linux-keystone2/source/odp_packet.c b/platform/linux-keystone2/source/odp_packet.c index 37a0d46..271d66b 100644 --- a/platform/linux-keystone2/source/odp_packet.c +++ b/platform/linux-keystone2/source/odp_packet.c @@ -25,9 +25,9 @@ void odp_packet_init(odp_packet_t pkt) { odp_packet_hdr_t *const pkt_hdr = odp_packet_hdr(pkt); - pkt_hdr->l2_offset = (uint32_t) ODP_PACKET_OFFSET_INVALID; - pkt_hdr->l3_offset = (uint32_t) ODP_PACKET_OFFSET_INVALID; - pkt_hdr->l4_offset = (uint32_t) ODP_PACKET_OFFSET_INVALID; + pkt_hdr->l2_offset = ODP_PACKET_OFFSET_INVALID; + pkt_hdr->l3_offset = ODP_PACKET_OFFSET_INVALID; + pkt_hdr->l4_offset = ODP_PACKET_OFFSET_INVALID; } odp_packet_t odp_packet_from_buffer(odp_buffer_t buf)