From patchwork Fri Mar 10 10:14:55 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Eremin-Solenikov X-Patchwork-Id: 95134 Delivered-To: patch@linaro.org Received: by 10.140.82.71 with SMTP id g65csp786782qgd; Fri, 10 Mar 2017 02:15:06 -0800 (PST) X-Received: by 10.55.16.230 with SMTP id 99mr19242289qkq.295.1489140906291; Fri, 10 Mar 2017 02:15:06 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id t25si7755507qtb.22.2017.03.10.02.15.05; Fri, 10 Mar 2017 02:15:06 -0800 (PST) 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; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 73A0D62CF3; Fri, 10 Mar 2017 10:15:05 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 9F48A60D90; Fri, 10 Mar 2017 10:15:01 +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 0A5D060D91; Fri, 10 Mar 2017 10:15:00 +0000 (UTC) Received: from mail-wm0-f41.google.com (mail-wm0-f41.google.com [74.125.82.41]) by lists.linaro.org (Postfix) with ESMTPS id 0226B60D83 for ; Fri, 10 Mar 2017 10:14:59 +0000 (UTC) Received: by mail-wm0-f41.google.com with SMTP id n11so6987135wma.0 for ; Fri, 10 Mar 2017 02:14:58 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id; bh=HjYTardrtunuqPBrkfSDqYvA3b+BJxFDMuL4f38rX8o=; b=umVkrZO5ZAD+b+fu7Z5Pe42JljZpXo+/SBwMKhnB+QEEn7i5OlGvx8b5EXi294bMh7 bzbWf723bQgaCSrkhs3afIfK+y+5owRCClxFN3qAB25bGx7MgaMXtK6eeyjiQ5qxYeEA xNE3EKEAOjf/RrszqoFiRJSCHpYhCd9wWRNGdpwm3kSHSBzgxfwc+4qv/trjHIy03IqY v9bWREDSqUGQsJpSgcemq/CEw/jd1cEuApgc5oIIpVVNW1vb3pnQhYY9omk/HvO/eN6j M5VM+FnpJElc341NWVUaDLPk/S8vDqBpUtEMCmooBDERL8Ij5l10c99vi39bpf+kzrkf hPwQ== X-Gm-Message-State: AFeK/H2/B6K/GKIVzgYV+nKiWnWUk83LwsikkyygZlqH5tcyg31sa1mlRgdp13Pz7Hrn+zK73+MF3g== X-Received: by 10.28.11.205 with SMTP id 196mr1555418wml.31.1489140897908; Fri, 10 Mar 2017 02:14:57 -0800 (PST) Received: from forlindon.c.hoisthospitality.com ([109.74.56.122]) by smtp.gmail.com with ESMTPSA id b10sm2575798wmi.34.2017.03.10.02.14.56 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 10 Mar 2017 02:14:57 -0800 (PST) From: Dmitry Eremin-Solenikov To: lng-odp@lists.linaro.org Date: Fri, 10 Mar 2017 13:14:55 +0300 Message-Id: <20170310101455.32505-1-dmitry.ereminsolenikov@linaro.org> X-Mailer: git-send-email 2.11.0 Subject: [lng-odp] [PATCH v2] linux-generic: pool: don't allocate buffers from invalid pool X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" Add ODP_ASSERT checking that passed pool is not ODP_POOL_INVALID before tring to allocate buffers from that pool. Signed-off-by: Dmitry Eremin-Solenikov --- platform/linux-generic/odp_pool.c | 4 ++++ 1 file changed, 4 insertions(+) -- 2.11.0 Reviewed-by: Bill Fischofer diff --git a/platform/linux-generic/odp_pool.c b/platform/linux-generic/odp_pool.c index cf7c2c41..2c1ba914 100644 --- a/platform/linux-generic/odp_pool.c +++ b/platform/linux-generic/odp_pool.c @@ -768,6 +768,8 @@ odp_buffer_t odp_buffer_alloc(odp_pool_t pool_hdl) pool_t *pool; int ret; + ODP_ASSERT(ODP_POOL_INVALID != pool_hdl); + pool = pool_entry_from_hdl(pool_hdl); ret = buffer_alloc_multi(pool, &buf, NULL, 1); @@ -781,6 +783,8 @@ int odp_buffer_alloc_multi(odp_pool_t pool_hdl, odp_buffer_t buf[], int num) { pool_t *pool; + ODP_ASSERT(ODP_POOL_INVALID != pool_hdl); + pool = pool_entry_from_hdl(pool_hdl); return buffer_alloc_multi(pool, buf, NULL, num);