From patchwork Mon Dec 11 18:00:17 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: 121433 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp3098340qgn; Mon, 11 Dec 2017 10:00:38 -0800 (PST) X-Google-Smtp-Source: ACJfBou80CXGIreIhEYj2UrLfg8ICINYg6FvDSKuuIBSzS1FFfig/9olppWggDZhktQOXWi59Akb X-Received: by 10.55.245.19 with SMTP id l19mr1730330qkk.157.1513015238148; Mon, 11 Dec 2017 10:00:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1513015238; cv=none; d=google.com; s=arc-20160816; b=JIIkPu7P6yNH5ondq/vRjehgaFiFrjxyFTlEdtM2UlqpAaKvnTBMQOsoLGC6oRwVzs +Z2pMGU1Q6puRC+FEbx8cCHTVEjcBkoIF1YC9yNf3gNrM1mgGLMk4slBp0x0a2dIULTY YkSR1JSwFH5ra9qplF1eNp4JlfyfzyhPXS4AVyiV0U/SCmxsFr7tyKLXXy7ztwE3H3b0 yFzgaKuJOekBeJLCe9aet9+SMdd0UaYevK7dw5bpFxNiYFABkbBcONhuttgdZsjGPaXc pshC5Zovm/RtkjvEj8YmVNk5n0PE8yfJC85NFPnsIjbi7jC8WCNqi1IMVw4VsKTZJPQn 4zIA== 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=oJzg1rPU8p5ibE/bw32aVMuZowmV4ylmZQHY2KlZ7F8=; b=hozplb7OYYtZWAcZxyZ+Exr/rzpjlTwwwxpFgoXQMyYypZQb1rfSEPDlyXo+zUgT2B HGtFDU9Aw03rDa4FW+xMBoN6erbNBeJfuW3/jgOI1g1esVmB+8PAngYtTxvWTFcW4Hqa QyIGG8jdekNt4lstdCDE+VCjwBmWq9W9v9fzofT7L4mF6UB4msybKKR8QQcTljz0DOFf M1GfxjmfVi6Xlvgem+Rv1PByHATHiF5iBMn6oi/BTBeGYo0KL/7VGbr/wcJqtBau26KK ufXMDLedvEMtpgBxVb1KpYqp/FzKqepjCYX3xKqTaIkkKaQXElsmKvThdPP5EEOIUopP yDKQ== 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 v2si4648678qtj.283.2017.12.11.10.00.35; Mon, 11 Dec 2017 10:00:38 -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 CF55D6098B; Mon, 11 Dec 2017 18:00:35 +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=-2.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW,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 45B6F60963; Mon, 11 Dec 2017 18:00:27 +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 138D76096D; Mon, 11 Dec 2017 18:00:24 +0000 (UTC) Received: from forward103p.mail.yandex.net (forward103p.mail.yandex.net [77.88.28.106]) by lists.linaro.org (Postfix) with ESMTPS id 991BF60963 for ; Mon, 11 Dec 2017 18:00:22 +0000 (UTC) Received: from mxback13g.mail.yandex.net (mxback13g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:92]) by forward103p.mail.yandex.net (Yandex) with ESMTP id 04FD42182C2B for ; Mon, 11 Dec 2017 21:00:21 +0300 (MSK) Received: from smtp3p.mail.yandex.net (smtp3p.mail.yandex.net [2a02:6b8:0:1472:2741:0:8b6:8]) by mxback13g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id XMUW199vZb-0KVKtcYN; Mon, 11 Dec 2017 21:00:20 +0300 Received: by smtp3p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id XFZb34qv4m-0KtWI4Wk; Mon, 11 Dec 2017 21:00:20 +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: Mon, 11 Dec 2017 21:00:17 +0300 Message-Id: <1513015219-14590-2-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1513015219-14590-1-git-send-email-odpbot@yandex.ru> References: <1513015219-14590-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 325 Subject: [lng-odp] [PATCH v2 1/3] 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: 6881620135a179911a5839d4be97423a8d80e5ab ** Merge commit sha: cf341d55ba51f9cd89def65a7be801b6d337330d **/ 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); From patchwork Mon Dec 11 18:00:19 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: 121434 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp3098887qgn; Mon, 11 Dec 2017 10:01:01 -0800 (PST) X-Google-Smtp-Source: ACJfBotGFe1zRpIoosv8fdO/VtAuObcXNOb0bHFI6njgrD52JpwWFVyIZ6LDzjoJ2F3znhpmueVo X-Received: by 10.200.38.33 with SMTP id u30mr1794878qtu.197.1513015261489; Mon, 11 Dec 2017 10:01:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1513015261; cv=none; d=google.com; s=arc-20160816; b=0FTVPz0iUXkjqgtlnohTZSq4U0IKzo4URtKF+E8tXJiEB9VbcwGpbdmFnxE1Lup5S/ PKIRc3zMLjQ9OMTt1EcYdptFKFxtLcL+iqY18WabM1QFvPg0KTm/nDQu/wyLQXz7PaRj NcOU/Ktn2S9KHddsqD406SutTObJfwoeJarNQW6JfGdZ200NoZPcta3fr11yweO7Ca3k u9IX/yKpCA264x6YdOi6ZEgeaa8x+6bPY5AsawLpIMZXyAN87yiKJ1LvorLvlDGvBWMT i5KVWRRTlNjU6xRuKV2MUyxFQ1oRNHO9+AeX5STJE2sDFaf0q4vJNlFpj1+EfdlltZHo Ackw== 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=5ijnIERHIDJpo1n0IA77687GeQJ42LrklThhPudOqQ8=; b=mpuAtXb1Mn+gdHDjMz1hRhFWEPvf02EC8jiyKFIjNcx485klLXViHBoRhjdHwzcngV FbEO1LdP7yRRLlkYf0+RWjze/62dTdTd8DS6NI+33Ke4IDEl5IfyeZN+TBK8KwTrA2z0 OGezzi5C5n+ifivQfCXo0w3eJMixGTTqXy1uHAMqoHakkV5uOCLuOKI093UsYRVz7cIY elC9Y2vxeSENdOx/kuDM7E+s0v3Tx8TWMnY+LGxD0zbLPXVeJOkXnxBQlaJjHo+EB5VD nBqqr1ehXnA/FntMZ+UkKuh81qW7/58f5/TTJvIP4JtSzWyKT7a1G3CFpSDawlvRpH4z jFCg== 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 p18si4668041qkp.305.2017.12.11.10.01.01; Mon, 11 Dec 2017 10:01:01 -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 2301960967; Mon, 11 Dec 2017 18:01:01 +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=-2.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW,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 95C5660969; Mon, 11 Dec 2017 18:00:29 +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 3924760965; Mon, 11 Dec 2017 18:00:26 +0000 (UTC) Received: from forward106o.mail.yandex.net (forward106o.mail.yandex.net [37.140.190.187]) by lists.linaro.org (Postfix) with ESMTPS id C672E60967 for ; Mon, 11 Dec 2017 18:00:23 +0000 (UTC) Received: from mxback9o.mail.yandex.net (mxback9o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::23]) by forward106o.mail.yandex.net (Yandex) with ESMTP id 3A6A6781957 for ; Mon, 11 Dec 2017 21:00:22 +0300 (MSK) Received: from smtp3p.mail.yandex.net (smtp3p.mail.yandex.net [2a02:6b8:0:1472:2741:0:8b6:8]) by mxback9o.mail.yandex.net (nwsmtp/Yandex) with ESMTP id ieVd4l1TLN-0MB8fEok; Mon, 11 Dec 2017 21:00:22 +0300 Received: by smtp3p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id XFZb34qv4m-0LtaF3Sx; Mon, 11 Dec 2017 21:00:21 +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: Mon, 11 Dec 2017 21:00:19 +0300 Message-Id: <1513015219-14590-4-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1513015219-14590-1-git-send-email-odpbot@yandex.ru> References: <1513015219-14590-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 325 Subject: [lng-odp] [PATCH v2 3/3] linux-generic: pool: avoid direct use of printf() in odp_pool_print() 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 Use ODP_PRINT() rather than printf() to send output through the log function. 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: 6881620135a179911a5839d4be97423a8d80e5ab ** Merge commit sha: cf341d55ba51f9cd89def65a7be801b6d337330d **/ platform/linux-generic/odp_pool.c | 54 +++++++++++++++++++-------------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/platform/linux-generic/odp_pool.c b/platform/linux-generic/odp_pool.c index 3b1811f50..2d56232d2 100644 --- a/platform/linux-generic/odp_pool.c +++ b/platform/linux-generic/odp_pool.c @@ -924,33 +924,33 @@ void odp_pool_print(odp_pool_t pool_hdl) pool = pool_entry_from_hdl(pool_hdl); - printf("\nPool info\n"); - printf("---------\n"); - printf(" pool %" PRIu64 "\n", - odp_pool_to_u64(pool->pool_hdl)); - printf(" name %s\n", pool->name); - printf(" pool type %s\n", - pool->params.type == ODP_POOL_BUFFER ? "buffer" : - (pool->params.type == ODP_POOL_PACKET ? "packet" : - (pool->params.type == ODP_POOL_TIMEOUT ? "timeout" : - "unknown"))); - printf(" pool shm %" PRIu64 "\n", - odp_shm_to_u64(pool->shm)); - printf(" user area shm %" PRIu64 "\n", - odp_shm_to_u64(pool->uarea_shm)); - printf(" num %u\n", pool->num); - printf(" align %u\n", pool->align); - printf(" headroom %u\n", pool->headroom); - printf(" seg len %u\n", pool->seg_len); - printf(" max data len %u\n", pool->max_len); - printf(" tailroom %u\n", pool->tailroom); - printf(" block size %u\n", pool->block_size); - printf(" uarea size %u\n", pool->uarea_size); - printf(" shm size %u\n", pool->shm_size); - printf(" base addr %p\n", pool->base_addr); - printf(" uarea shm size %u\n", pool->uarea_shm_size); - printf(" uarea base addr %p\n", pool->uarea_base_addr); - printf("\n"); + ODP_PRINT("\nPool info\n"); + ODP_PRINT("---------\n"); + ODP_PRINT(" pool %" PRIu64 "\n", + odp_pool_to_u64(pool->pool_hdl)); + ODP_PRINT(" name %s\n", pool->name); + ODP_PRINT(" pool type %s\n", + pool->params.type == ODP_POOL_BUFFER ? "buffer" : + (pool->params.type == ODP_POOL_PACKET ? "packet" : + (pool->params.type == ODP_POOL_TIMEOUT ? "timeout" : + "unknown"))); + ODP_PRINT(" pool shm %" PRIu64 "\n", + odp_shm_to_u64(pool->shm)); + ODP_PRINT(" user area shm %" PRIu64 "\n", + odp_shm_to_u64(pool->uarea_shm)); + ODP_PRINT(" num %u\n", pool->num); + ODP_PRINT(" align %u\n", pool->align); + ODP_PRINT(" headroom %u\n", pool->headroom); + ODP_PRINT(" seg len %u\n", pool->seg_len); + ODP_PRINT(" max data len %u\n", pool->max_len); + ODP_PRINT(" tailroom %u\n", pool->tailroom); + ODP_PRINT(" block size %u\n", pool->block_size); + ODP_PRINT(" uarea size %u\n", pool->uarea_size); + ODP_PRINT(" shm size %u\n", pool->shm_size); + ODP_PRINT(" base addr %p\n", pool->base_addr); + ODP_PRINT(" uarea shm size %u\n", pool->uarea_shm_size); + ODP_PRINT(" uarea base addr %p\n", pool->uarea_base_addr); + ODP_PRINT("\n"); } odp_pool_t odp_buffer_pool(odp_buffer_t buf)