From patchwork Thu Apr 2 11:11:56 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stuart Haslam X-Patchwork-Id: 46724 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f197.google.com (mail-wi0-f197.google.com [209.85.212.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 32D69216D1 for ; Thu, 2 Apr 2015 11:12:13 +0000 (UTC) Received: by wibgr10 with SMTP id gr10sf18043332wib.2 for ; Thu, 02 Apr 2015 04:12:12 -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=K6i4429l2m2mGiyTjnkMJhO2F12XCywywYOa8/gG6FQ=; b=mSdVul+Zq1g+4KjqmVZHuVmn/6/4o84R2RFKx0ECNAlUHC3QzKwf3g1kNP6ufgaDBv vfvp2l3ls1P5YMq2nequkk3oSZ67nXgL5exYzRqLa7xwxE3ZX+PlG2c0QH+MXD+SOCKq 3fmsql5rJfKfPw0M78Zewhj7rfm2+PhzLOOfYO0tzQfpAqgNdakJVwOstAGvCngUYsWn OWnnJVGI08oXZHM9KHlopUeua8l2kw3q7OtqEzBoAPqL8hGkELVGuDal2J/bh1gv5ug/ 2vbzWqzfUD7dQd+vKaOp/OoCLy/T1BMgBxl3IAE4aKfHqY8vMhfVZWr8skWaaShEuVEI QAWw== X-Gm-Message-State: ALoCoQkDiQU+Pkeuk6NHBZ3KHt8ghDHO+PleOA3OUDP/ejKYAM+e2jQ9jRoHzEucZnXTxCcZKf4C X-Received: by 10.194.11.70 with SMTP id o6mr12101776wjb.6.1427973132528; Thu, 02 Apr 2015 04:12:12 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.181.5 with SMTP id ds5ls217700lac.20.gmail; Thu, 02 Apr 2015 04:12:12 -0700 (PDT) X-Received: by 10.112.72.36 with SMTP id a4mr23624978lbv.58.1427973132156; Thu, 02 Apr 2015 04:12:12 -0700 (PDT) Received: from mail-la0-f51.google.com (mail-la0-f51.google.com. [209.85.215.51]) by mx.google.com with ESMTPS id n1si3992400lbc.29.2015.04.02.04.12.12 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 02 Apr 2015 04:12:12 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.51 as permitted sender) client-ip=209.85.215.51; Received: by lagg8 with SMTP id g8so57569814lag.1 for ; Thu, 02 Apr 2015 04:12:12 -0700 (PDT) X-Received: by 10.112.141.202 with SMTP id rq10mr40303901lbb.88.1427973132061; Thu, 02 Apr 2015 04:12:12 -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.57.201 with SMTP id k9csp1261999lbq; Thu, 2 Apr 2015 04:12:11 -0700 (PDT) X-Received: by 10.140.42.130 with SMTP id c2mr7481197qga.94.1427973130771; Thu, 02 Apr 2015 04:12:10 -0700 (PDT) Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id z3si4676025qcp.5.2015.04.02.04.12.10; Thu, 02 Apr 2015 04:12:10 -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: by lists.linaro.org (Postfix, from userid 109) id 0BE1065085; Thu, 2 Apr 2015 11:12:10 +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=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,URIBL_BLOCKED autolearn=ham autolearn_force=no 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 57ABD65071; Thu, 2 Apr 2015 11:12:09 +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 B303C6507E; Thu, 2 Apr 2015 11:12:08 +0000 (UTC) Received: from mail-wi0-f176.google.com (mail-wi0-f176.google.com [209.85.212.176]) by lists.linaro.org (Postfix) with ESMTPS id 3E07C6507E for ; Thu, 2 Apr 2015 11:12:08 +0000 (UTC) Received: by wibgn9 with SMTP id gn9so101153565wib.1 for ; Thu, 02 Apr 2015 04:12:07 -0700 (PDT) X-Received: by 10.180.108.233 with SMTP id hn9mr23238559wib.73.1427973127561; Thu, 02 Apr 2015 04:12:07 -0700 (PDT) Received: from e106441.cambridge.arm.com ([2001:41d0:a:3cb4::1]) by mx.google.com with ESMTPSA id es2sm15154119wib.8.2015.04.02.04.12.06 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 02 Apr 2015 04:12:06 -0700 (PDT) From: Stuart Haslam To: lng-odp@lists.linaro.org Date: Thu, 2 Apr 2015 12:11:56 +0100 Message-Id: <1427973116-14859-1-git-send-email-stuart.haslam@linaro.org> X-Mailer: git-send-email 2.1.1 X-Topics: patch Subject: [lng-odp] [PATCH] linux-generic: pool: check for NULL params before dereference 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: stuart.haslam@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.51 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 Signed-off-by: Stuart Haslam Reviewed-by: Bill Fischofer --- platform/linux-generic/odp_pool.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/platform/linux-generic/odp_pool.c b/platform/linux-generic/odp_pool.c index 468b7a5..bf49623 100644 --- a/platform/linux-generic/odp_pool.c +++ b/platform/linux-generic/odp_pool.c @@ -143,6 +143,9 @@ odp_pool_t odp_pool_create(const char *name, pool_entry_t *pool; uint32_t i, headroom = 0, tailroom = 0; + if (params == NULL) + return ODP_POOL_INVALID; + /* Default size and align for timeouts */ if (params->type == ODP_POOL_TIMEOUT) { params->buf.size = 0; /* tmo.__res1 */ @@ -158,9 +161,6 @@ odp_pool_t odp_pool_create(const char *name, _odp_buffer_pool_init_t *init_params = &default_init_params; - if (params == NULL) - return ODP_POOL_INVALID; - /* Restriction for v1.0: All non-packet buffers are unsegmented */ int unseg = 1;