From patchwork Mon Apr 4 09:11:41 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Balakrishna Garapati X-Patchwork-Id: 64979 Delivered-To: patch@linaro.org Received: by 10.112.199.169 with SMTP id jl9csp1072992lbc; Mon, 4 Apr 2016 02:11:54 -0700 (PDT) X-Received: by 10.141.2.198 with SMTP id e189mr12302681qhd.64.1459761114710; Mon, 04 Apr 2016 02:11:54 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id 138si21582103qhr.60.2016.04.04.02.11.54; Mon, 04 Apr 2016 02:11:54 -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; 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 dis=NONE) header.from=linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 3829661649; Mon, 4 Apr 2016 09:11:54 +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, 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 5B34C61606; Mon, 4 Apr 2016 09:11:49 +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 F01E46162C; Mon, 4 Apr 2016 09:11:46 +0000 (UTC) Received: from mail-lf0-f54.google.com (mail-lf0-f54.google.com [209.85.215.54]) by lists.linaro.org (Postfix) with ESMTPS id D6DB56156A for ; Mon, 4 Apr 2016 09:11:44 +0000 (UTC) Received: by mail-lf0-f54.google.com with SMTP id g184so85515880lfb.3 for ; Mon, 04 Apr 2016 02:11:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=tbLGzhxaEH5HeTw5oUSQDYoeR3BwPq4cBN4GqMY1r8I=; b=dWDS6JDLPL5YzU/Xl/2bEL2CeaAvK3K+WNLhstPLmPR0+UsePvcNk3Yuj18muawArc lm9rS8DIET8oNHCD5uUCDT81wFaHsjoUD0IKPQQIHIb06J3T3ZIjbcxp4M9JUHvif5/B tHETuN8iMRkx3eWjtr9XC9SN4wn+ooB9c3EWOA9h5KPwyChLpr5XEfTZCq8Lr3Fs5/Gl i0nXkOLPXPThdjl8nUJgRsxcrVVd5XLVTcQHLPBJG1oJdjmi8ayn4sVLaURj8w087lVZ BxcBOyivhGNLltqZyT9Aq/r+Jz9cGEROthOPywTY5RTs7fsFt5zUN6629jlvMOyZHOPD tCgQ== X-Gm-Message-State: AD7BkJKIvM1SZiC7uyF+6spZaTPUnquGOhHiLkDKbeGfxs6qUaPng1aJ92FnZW8gEG7fyGHngVc= X-Received: by 10.25.127.208 with SMTP id a199mr7849625lfd.46.1459761103281; Mon, 04 Apr 2016 02:11:43 -0700 (PDT) Received: from elxahtkds32.localdomain (host-95-192-150-123.mobileonline.telia.com. [95.192.150.123]) by smtp.gmail.com with ESMTPSA id um4sm4464674lbb.1.2016.04.04.02.11.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 04 Apr 2016 02:11:42 -0700 (PDT) From: Balakrishna Garapati To: bala.manoharan@linaro.org, maxim.uvarov@linaro.org Date: Mon, 4 Apr 2016 11:11:41 +0200 Message-Id: <1459761101-21867-1-git-send-email-balakrishna.garapati@linaro.org> X-Mailer: git-send-email 1.9.1 X-Topics: patch Cc: lng-odp@lists.linaro.org Subject: [lng-odp] [PATCH] test/performance:Avoid possible out-of-bounds memory access 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: , MIME-Version: 1.0 Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" Resolving https://bugs.linaro.org/show_bug.cgi?id=2136 by initializing definite number of worker threads. Signed-off-by: Balakrishna Garapati --- test/performance/odp_crypto.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) -- 1.9.1 diff --git a/test/performance/odp_crypto.c b/test/performance/odp_crypto.c index fe1c7b4..32b41ef 100644 --- a/test/performance/odp_crypto.c +++ b/test/performance/odp_crypto.c @@ -719,12 +719,12 @@ int main(int argc, char *argv[]) odp_pool_t pool; odp_queue_param_t qparam; odp_pool_param_t params; - odph_linux_pthread_t thr; odp_queue_t out_queue = ODP_QUEUE_INVALID; thr_arg_t thr_arg; - int num_workers = 1; odp_cpumask_t cpumask; char cpumaskstr[ODP_CPUMASK_STR_SIZE]; + int num_workers = 1; + odph_linux_pthread_t thr[num_workers]; memset(&cargs, 0, sizeof(cargs)); @@ -793,13 +793,15 @@ int main(int argc, char *argv[]) printf("Run in sync mode\n"); } + memset(thr, 0, sizeof(thr)); + if (cargs.alg_config) { if (cargs.schedule) { - odph_linux_pthread_create(&thr, &cpumask, + odph_linux_pthread_create(&thr[0], &cpumask, run_thr_func, &thr_arg, ODP_THREAD_WORKER); - odph_linux_pthread_join(&thr, num_workers); + odph_linux_pthread_join(thr, num_workers); } else { run_measure_one_config(&cargs, cargs.alg_config); }