From patchwork Thu Dec 7 00:00:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 120910 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp7696989qgn; Wed, 6 Dec 2017 16:00:43 -0800 (PST) X-Google-Smtp-Source: AGs4zMYrTW+iKTQzJVaW1SHJoZ0pcEG0yS9XcKwQMKjLzlHpr5NumbW32bN+tZAENwBAqKjrUV++ X-Received: by 10.200.63.209 with SMTP id v17mr6459029qtk.242.1512604843094; Wed, 06 Dec 2017 16:00:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512604843; cv=none; d=google.com; s=arc-20160816; b=0eoKaZzIBiOdDgc9lDoxhHEBK8poIVPQSSLyxfPdqNAumjeKZYxNwL/yRhWxZbtUa1 3s8LXl/MUhLFaY6QoAbc382WEztz79NRG9Kc7W79SDnRGFXpA4Q0R2RWejgQ2oT38b3D gLSfYQcSQ+Dm8QkhZhrIyG6XRHSt3vGBuC3bwpZMV0Oi8z4EJlqlUzVq4dWN01wuy8tn LEUFzmlmkoG+GPGdVfeJ/1HBriWdRiQ4GZc0mqiTmTOalG4TrIcpQsKihn35IMACix8W HyYaDcJgBpSZkdGVNdLQhKOwsGDA6jX69rPPQMmRqOb9e9C2oJOFNnwoTMsHr8SygJSK zgog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:github-pr-num :references:in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=c2zQdE+rUhKjTS/8aYhjGt0zRz8LSJnbEHx4NSWifac=; b=lx6d6NiMNLXA66/5I0iBvBSUTb36Z+RW0/QDHJWylEUKMhTOsLk0RW5ajhDdxkuCsb RVpdj0Q5tyD727n/iYAMPFKniZsErPsiIm+nhmpqU2VU2dYxbpa60T7yZhEXUpZ97hy3 17THDDIWEtz0eU4JbOX37NAm6kUh14Eb468x5G3J0xDXux9YlWLBK/N535X9mF5n/LYV 7wCW1o8esXONyy4DRsTACU1cfQJJT+QYxTk2WymHfYa4x3yZbYPujCi4ov3zEazVxG3t A41voBegEz6PTEGdiyj0xrulE4AiBUEDKz3GyHbBPLUIwBy7eO2fumq3DQg33JNJjKu1 ocAA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from lists.linaro.org (ec2-54-197-127-237.compute-1.amazonaws.com. [54.197.127.237]) by mx.google.com with ESMTP id w19si2102784qka.243.2017.12.06.16.00.42; Wed, 06 Dec 2017 16:00:43 -0800 (PST) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) client-ip=54.197.127.237; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: by lists.linaro.org (Postfix, from userid 109) id BADD9608FD; Thu, 7 Dec 2017 00:00:42 +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=-5.4 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2 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 335B2608E8; Thu, 7 Dec 2017 00:00: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 BA31C608E0; Thu, 7 Dec 2017 00:00:16 +0000 (UTC) Received: from forward106p.mail.yandex.net (forward106p.mail.yandex.net [77.88.28.109]) by lists.linaro.org (Postfix) with ESMTPS id 9DAD860686 for ; Thu, 7 Dec 2017 00:00:10 +0000 (UTC) Received: from mxback10j.mail.yandex.net (mxback10j.mail.yandex.net [IPv6:2a02:6b8:0:1619::113]) by forward106p.mail.yandex.net (Yandex) with ESMTP id 48ED82D844E5 for ; Thu, 7 Dec 2017 03:00:09 +0300 (MSK) Received: from smtp4o.mail.yandex.net (smtp4o.mail.yandex.net [2a02:6b8:0:1a2d::28]) by mxback10j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id NfMA5Q55o8-09CW366h; Thu, 07 Dec 2017 03:00:09 +0300 Received: by smtp4o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id G5Zi21mh5A-08YS5DAl; Thu, 07 Dec 2017 03:00:08 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Thu, 7 Dec 2017 03:00:06 +0300 Message-Id: <1512604806-11902-2-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1512604806-11902-1-git-send-email-odpbot@yandex.ru> References: <1512604806-11902-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 325 Subject: [lng-odp] [PATCH v1 1/1] linux-generic: pool: validate params before creating 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" From: Bill Fischofer Enhance the check_params() routine to verify that params != NULL prior to dereferencing it. This fixes Bug https://bugs.linaro.org/show_bug.cgi?id=3465 Signed-off-by: Bill Fischofer --- /** Email created from pull request 325 (Bill-Fischofer-Linaro:bug3465) ** https://github.com/Linaro/odp/pull/325 ** Patch: https://github.com/Linaro/odp/pull/325.patch ** Base sha: 811281a22b6274b7f41b926a9cfbe09e48a366bd ** Merge commit sha: e4c1abbb09f77567329fdfcf371b58094693a173 **/ platform/linux-generic/odp_pool.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/platform/linux-generic/odp_pool.c b/platform/linux-generic/odp_pool.c index c0dd41ebf..b3c652360 100644 --- a/platform/linux-generic/odp_pool.c +++ b/platform/linux-generic/odp_pool.c @@ -352,11 +352,6 @@ static odp_pool_t pool_create(const char *name, odp_pool_param_t *params, const char *postfix = "_uarea"; char uarea_name[ODP_POOL_NAME_LEN + sizeof(postfix)]; - if (params == NULL) { - ODP_ERR("No params"); - return ODP_POOL_INVALID; - } - align = 0; if (params->type == ODP_POOL_BUFFER) @@ -533,7 +528,7 @@ static int check_params(odp_pool_param_t *params) { odp_pool_capability_t capa; - if (odp_pool_capability(&capa) < 0) + if (!params || odp_pool_capability(&capa) < 0) return -1; switch (params->type) { @@ -603,7 +598,7 @@ odp_pool_t odp_pool_create(const char *name, odp_pool_param_t *params) if (check_params(params)) return ODP_POOL_INVALID; - if (params && (params->type == ODP_POOL_PACKET)) + if (params->type == ODP_POOL_PACKET) shm_flags = ODP_SHM_PROC; return pool_create(name, params, shm_flags);