From patchwork Wed Apr 30 05:08:30 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sanjay Singh Rawat X-Patchwork-Id: 29383 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yh0-f71.google.com (mail-yh0-f71.google.com [209.85.213.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id EE96B202FE for ; Wed, 30 Apr 2014 05:08:50 +0000 (UTC) Received: by mail-yh0-f71.google.com with SMTP id i57sf4467730yha.2 for ; Tue, 29 Apr 2014 22:08:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=rzW6vmkeUCukmA5ZSqqsMMjMwobMIeZtMgc6Um5/V44=; b=VMuAWjqyHxwrok3Seh3syS6sjGQG7z5POPhLeHko8XgzpmuoKoEraXjjqr5PLk84kn 5U0iolTnvaJExsA4wxLmltcAxtQ6kiorwAs4UwHn0CQIR5mgqWaFMxj/qCE35bLKShdI JM7WwaoxQD9HQUHWHNDf6SyDBMHNX/7AbUxxk1gXG5yOU32tQOsBRlX9VIfKoqba2YOK C3BCnOKbCSGwVlzr3ZKVX11JXA8fBBTHOo4vQ5eCv9mRoZRThc3Bs0O414EUFjGOVtkr 7da0DXpEhVYeDQQnHMDqrpn+PaJE1X0ODe7cmFKoaln5SS9CKJ9CndqOw3AmOb3YlvNG fJ2w== X-Gm-Message-State: ALoCoQmIvnNF4VVVEfcTeXEeDzNAXYlGBADpQ3XijQUQ+NBpg6rVIhcgzY889jZGyDe3pKajtmBN X-Received: by 10.236.231.52 with SMTP id k50mr1067235yhq.52.1398834530741; Tue, 29 Apr 2014 22:08:50 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.40.209 with SMTP id x75ls420879qgx.46.gmail; Tue, 29 Apr 2014 22:08:50 -0700 (PDT) X-Received: by 10.221.20.199 with SMTP id qp7mr1976457vcb.24.1398834530657; Tue, 29 Apr 2014 22:08:50 -0700 (PDT) Received: from mail-vc0-f174.google.com (mail-vc0-f174.google.com [209.85.220.174]) by mx.google.com with ESMTPS id eb17si5083194veb.184.2014.04.29.22.08.50 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 29 Apr 2014 22:08:50 -0700 (PDT) Received-SPF: none (google.com: patch+caf_=patchwork-forward=linaro.org@linaro.org does not designate permitted sender hosts) client-ip=209.85.220.174; Received: by mail-vc0-f174.google.com with SMTP id ib6so1538722vcb.19 for ; Tue, 29 Apr 2014 22:08:50 -0700 (PDT) X-Received: by 10.52.53.101 with SMTP id a5mr1700291vdp.14.1398834530582; Tue, 29 Apr 2014 22:08:50 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.221.72 with SMTP id ib8csp250114vcb; Tue, 29 Apr 2014 22:08:50 -0700 (PDT) X-Received: by 10.66.142.132 with SMTP id rw4mr4636849pab.6.1398834529762; Tue, 29 Apr 2014 22:08:49 -0700 (PDT) Received: from mail-pd0-f179.google.com (mail-pd0-f179.google.com [209.85.192.179]) by mx.google.com with ESMTPS id lk4si8949430pab.227.2014.04.29.22.08.49 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 29 Apr 2014 22:08:49 -0700 (PDT) Received-SPF: none (google.com: sanjay.rawat@linaro.org does not designate permitted sender hosts) client-ip=209.85.192.179; Received: by mail-pd0-f179.google.com with SMTP id y10so1169701pdj.10 for ; Tue, 29 Apr 2014 22:08:49 -0700 (PDT) X-Received: by 10.66.148.70 with SMTP id tq6mr4629553pab.56.1398834529161; Tue, 29 Apr 2014 22:08:49 -0700 (PDT) Received: from srawat-Latitude-E6420.LGE.NET ([203.247.149.152]) by mx.google.com with ESMTPSA id kt8sm126662316pab.7.2014.04.29.22.08.45 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 29 Apr 2014 22:08:48 -0700 (PDT) From: Sanjay Singh Rawat To: daniel.lezcano@linaro.org, lorenzo.pieralisi@arm.com Cc: linaro-dev@lists.linaro.org, Sanjay Singh Rawat Subject: [PATCH PMQA] cpuidle_killer: allocate per cpu process array dynamically Date: Wed, 30 Apr 2014 10:38:30 +0530 Message-Id: <1398834510-8433-1-git-send-email-sanjay.rawat@linaro.org> X-Mailer: git-send-email 1.7.10.4 X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: sanjay.rawat@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: patch+caf_=patchwork-forward=linaro.org@linaro.org does not designate permitted sender hosts) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , currently percpu process array is set to 2, which results in segfault Signed-off-by: Sanjay Singh Rawat --- cpuidle/cpuidle_killer.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cpuidle/cpuidle_killer.c b/cpuidle/cpuidle_killer.c index 5e7320f..09009ef 100644 --- a/cpuidle/cpuidle_killer.c +++ b/cpuidle/cpuidle_killer.c @@ -104,7 +104,7 @@ int main(int argc, char *argv[]) { int ret, i, nrcpus = 2; int nrsleeps, delay; - pid_t pids[nrcpus]; + pid_t *pids; struct timex timex = { 0 }; if (adjtimex(&timex) < 0) { @@ -121,6 +121,11 @@ int main(int argc, char *argv[]) } fprintf(stderr, "found %d cpu(s)\n", nrcpus); + pids = (pid_t *) calloc(nrcpus, sizeof(pid_t)); + if (pids == NULL) { + fprintf(stderr, "error: calloc failed\n"); + return 1; + } for (i = 0; i < nrcpus; i++) {