From patchwork Thu Jun 25 21:48:11 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill Fischofer X-Patchwork-Id: 50332 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f198.google.com (mail-wi0-f198.google.com [209.85.212.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 3D772228FD for ; Thu, 25 Jun 2015 21:48:29 +0000 (UTC) Received: by wiws10 with SMTP id s10sf490286wiw.2 for ; Thu, 25 Jun 2015 14:48:28 -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=bIbkvEqQQjEjyeUip6LnitRzpceOEg71d0KSpiLtOs0=; b=j+jCqHlU6M8BF2QCvDCgRyMLBzm++c742X6V7TIvei8bnpJaeviVoEUtj0v6dLEvvc Ud9HWabGf9eW3xuJtYolcoHWNqLAwjOKjK6fYifgVwfx48q72Dzpa0eB44b3IkOuwlCm DTch9fxFYZTqrnf/9Rtadu0nznTMKWSH2Iy0wNuz6bnWhasg0U1QGM+RYOzg9JJOesEe 49qXD/MoJioKVNOJFHerUOunYlbyxR4O21Vj+JhOtCKzc6d3wuMk5f1zo4z9ts09ITlz A0gmAQfVBI0K5qsndeissKfhJ7kfpiVW07WyqMO6P/PdOcFwIMIqN0R7Tld1DDdu5avE mMHw== X-Gm-Message-State: ALoCoQnP6P5ZWqWrg8E8YWQw8lj6Z+eAe9JbqI2fQIenkYEpZ0ie3REZY9wFB6Vaan5tAHGR/M7K X-Received: by 10.180.216.12 with SMTP id om12mr3740124wic.1.1435268908347; Thu, 25 Jun 2015 14:48:28 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.179.201 with SMTP id di9ls431899lac.92.gmail; Thu, 25 Jun 2015 14:48:28 -0700 (PDT) X-Received: by 10.152.198.135 with SMTP id jc7mr46397189lac.48.1435268908056; Thu, 25 Jun 2015 14:48:28 -0700 (PDT) Received: from mail-lb0-f176.google.com (mail-lb0-f176.google.com. [209.85.217.176]) by mx.google.com with ESMTPS id yg5si25678327lab.174.2015.06.25.14.48.28 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 25 Jun 2015 14:48:28 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.176 as permitted sender) client-ip=209.85.217.176; Received: by lbbvz5 with SMTP id vz5so53607826lbb.0 for ; Thu, 25 Jun 2015 14:48:28 -0700 (PDT) X-Received: by 10.112.131.98 with SMTP id ol2mr47736725lbb.56.1435268907834; Thu, 25 Jun 2015 14:48:27 -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.108.230 with SMTP id hn6csp872748lbb; Thu, 25 Jun 2015 14:48:27 -0700 (PDT) X-Received: by 10.55.33.203 with SMTP id f72mr87379497qki.52.1435268906633; Thu, 25 Jun 2015 14:48:26 -0700 (PDT) Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id f36si28692216qki.120.2015.06.25.14.48.25; Thu, 25 Jun 2015 14:48:26 -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 0B6E4620D0; Thu, 25 Jun 2015 21:48:25 +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_H3, RCVD_IN_MSPIKE_WL, 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 B3A29620AC; Thu, 25 Jun 2015 21:48:21 +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 EA224620AC; Thu, 25 Jun 2015 21:48:19 +0000 (UTC) Received: from mail-oi0-f49.google.com (mail-oi0-f49.google.com [209.85.218.49]) by lists.linaro.org (Postfix) with ESMTPS id CE77C61D66 for ; Thu, 25 Jun 2015 21:48:18 +0000 (UTC) Received: by oiax193 with SMTP id x193so62621183oia.2 for ; Thu, 25 Jun 2015 14:48:18 -0700 (PDT) X-Received: by 10.182.99.202 with SMTP id es10mr41378502obb.47.1435268898333; Thu, 25 Jun 2015 14:48:18 -0700 (PDT) Received: from localhost.localdomain (cpe-24-28-70-239.austin.res.rr.com. [24.28.70.239]) by mx.google.com with ESMTPSA id x77sm1491475oix.7.2015.06.25.14.48.17 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 25 Jun 2015 14:48:17 -0700 (PDT) From: Bill Fischofer To: lng-odp@lists.linaro.org Date: Thu, 25 Jun 2015 16:48:11 -0500 Message-Id: <1435268892-22935-1-git-send-email-bill.fischofer@linaro.org> X-Mailer: git-send-email 2.1.0 X-Topics: patch Subject: [lng-odp] [PATCH 1/2] linux-generic: buffers: correct segment length calculation for packets 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: bill.fischofer@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.217.176 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 Fix for Bug https://bugs.linaro.org/show_bug.cgi?id=1661 Signed-off-by: Bill Fischofer --- platform/linux-generic/include/odp_buffer_inlines.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/platform/linux-generic/include/odp_buffer_inlines.h b/platform/linux-generic/include/odp_buffer_inlines.h index 91e56bd..74af38b 100644 --- a/platform/linux-generic/include/odp_buffer_inlines.h +++ b/platform/linux-generic/include/odp_buffer_inlines.h @@ -182,7 +182,9 @@ static inline void *segment_map(odp_buffer_hdr_t *buf, /* Set seglen if caller is asking for it */ if (seglen != NULL) { buf_left = limit - seg_offset; - *seglen = buf_left < buf->segsize ? buf_left : buf->segsize; + *seglen = buf_left < buf->segsize ? buf_left : + (seg_offset >= buf->segsize ? buf->segsize : + buf->segsize - seg_offset); } return (void *)seg_addr;