From mboxrd@z Thu Jan 1 00:00:00 1970 From: Akshay Adiga Subject: Re: [PATCH] cpufreq: powernv: fix missing check of return value in init_powernv_pstates() Date: Mon, 18 Feb 2019 00:41:49 +0530 Message-ID: <20190217190155.GA25556@aks.ibm> References: <20190216170623.12634-1-tiny.windzz@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: <20190216170623.12634-1-tiny.windzz@gmail.com> Sender: linux-kernel-owner@vger.kernel.org To: Yangtao Li Cc: rjw@rjwysocki.net, viresh.kumar@linaro.org, benh@kernel.crashing.org, paulus@samba.org, mpe@ellerman.id.au, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org List-Id: linux-pm@vger.kernel.org On Sat, Feb 16, 2019 at 12:06:23PM -0500, Yangtao Li wrote: > kmalloc() could fail, so insert a check of its return value. And > if it fails, returns -ENOMEM. > > And remove (struct pstate_idx_revmap_data *) to fix coccinelle WARNING > by the way. > > WARNING: casting value returned by memory allocation function to (struct > pstate_idx_revmap_data *) is useless. > > Signed-off-by: Yangtao Li > --- > drivers/cpufreq/powernv-cpufreq.c | 10 +++++++--- > 1 file changed, 7 insertions(+), 3 deletions(-) > Looks good to me. Thanks for fixing this. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.5 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS,USER_AGENT_MUTT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D5544C43381 for ; Sun, 17 Feb 2019 19:13:37 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0563B2186A for ; Sun, 17 Feb 2019 19:13:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0563B2186A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.vnet.ibm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 442c9B0jMMzDqLd for ; Mon, 18 Feb 2019 06:13:34 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; spf=none (mailfrom) smtp.mailfrom=linux.vnet.ibm.com (client-ip=148.163.158.5; helo=mx0a-001b2d01.pphosted.com; envelope-from=akshay.adiga@linux.vnet.ibm.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 442c7T5bCtzDqKN for ; Mon, 18 Feb 2019 06:12:02 +1100 (AEDT) Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x1HJ9IRr173518 for ; Sun, 17 Feb 2019 14:11:59 -0500 Received: from e06smtp05.uk.ibm.com (e06smtp05.uk.ibm.com [195.75.94.101]) by mx0b-001b2d01.pphosted.com with ESMTP id 2qqcm79d1s-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Sun, 17 Feb 2019 14:11:59 -0500 Received: from localhost by e06smtp05.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Sun, 17 Feb 2019 19:11:57 -0000 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) by e06smtp05.uk.ibm.com (192.168.101.135) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Sun, 17 Feb 2019 19:11:55 -0000 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x1HJBsvx19398776 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Sun, 17 Feb 2019 19:11:54 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 15471A4053; Sun, 17 Feb 2019 19:11:54 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 07F01A4051; Sun, 17 Feb 2019 19:11:52 +0000 (GMT) Received: from aks.ibm (unknown [9.85.68.185]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Sun, 17 Feb 2019 19:11:51 +0000 (GMT) Date: Mon, 18 Feb 2019 00:41:49 +0530 From: Akshay Adiga To: Yangtao Li Subject: Re: [PATCH] cpufreq: powernv: fix missing check of return value in init_powernv_pstates() References: <20190216170623.12634-1-tiny.windzz@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190216170623.12634-1-tiny.windzz@gmail.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-TM-AS-GCONF: 00 x-cbid: 19021719-0020-0000-0000-00000317CFBB X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19021719-0021-0000-0000-000021690B64 Message-Id: <20190217190155.GA25556@aks.ibm> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-02-17_13:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1902170148 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-pm@vger.kernel.org, viresh.kumar@linaro.org, rjw@rjwysocki.net, linux-kernel@vger.kernel.org, paulus@samba.org, linuxppc-dev@lists.ozlabs.org Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" On Sat, Feb 16, 2019 at 12:06:23PM -0500, Yangtao Li wrote: > kmalloc() could fail, so insert a check of its return value. And > if it fails, returns -ENOMEM. > > And remove (struct pstate_idx_revmap_data *) to fix coccinelle WARNING > by the way. > > WARNING: casting value returned by memory allocation function to (struct > pstate_idx_revmap_data *) is useless. > > Signed-off-by: Yangtao Li > --- > drivers/cpufreq/powernv-cpufreq.c | 10 +++++++--- > 1 file changed, 7 insertions(+), 3 deletions(-) > Looks good to me. Thanks for fixing this.