Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp470108pxu; Thu, 7 Jan 2021 09:25:42 -0800 (PST) X-Google-Smtp-Source: ABdhPJwl+YECXoNGS27OFURKyJOZEFtkrBH4NJ3Qg3x40ZrFDcSJdKfBbTLUFf8arSMEjaRnuR/l X-Received: by 2002:a17:906:451:: with SMTP id e17mr6867632eja.228.1610040342282; Thu, 07 Jan 2021 09:25:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610040342; cv=none; d=google.com; s=arc-20160816; b=KtK309OhHb3ivdMiQyd1b7srZMs7a3vBsDhuAntYSdCWb6MCrP4IxGD3b6aZbI7Mfx jL88xJ9m5xpKmUcZha0RqP3Hyw1gCXSGpckr42mZJabyXjnHGBEcsyPBwLZPQPH5ryFi tFcMOGjGr5cDOBlSmxSsCxZkU8SV1sg1xhjpd9LHIT7H8jkTVH1NINh/19xxZz2CpwmY 7T4u7GUJ6SbRSR64idihHB0Sqk4muSNgIWpoMNj4VdrCi4CeSG+2uiQywb611WWEAP7X /s6+d6kHyR3QPj16bEam3egk69/XZd6vgK7kk4tR4DpMW7Uf8wArUvZzSG9Y5mbucMS2 W84g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version; bh=6X7ecX3ktj7GRqg15is1tMYVK2Fo6Raj6Z2b9WYs1KY=; b=ZmVcp/B9mPCM7dnDy0eeFAZArZfpLwZOF40jP1SnAu0Ap8PbBbEbAlRSlryoCJeDbp 0LRRRqZl+kqah5L+KMftK4pB9Ro4eY0kObs5DFQW6JmtXnILiALRvUL0yC4LTbGgkYez Hzt4YHn3ii9Nt+sibNWOrnpihA9FTHP2rMJTKQVfexgShM+Fv2EC7qCWVrDtNZxWc9Pi AfRpsTzPl95/fT7X7DHPWv2fEhM8Og215OSrpUXmG+IPEX29Rx9AJ//7El2MuIpm/Px6 dnBy+r1sjEum+AdIdPXaBvw9/MwhxE/sRF2N5eWgR9MsRgpeqSOsKPrjyx16CqPSWf6H B7Rw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v8si2402425ejj.305.2021.01.07.09.25.18; Thu, 07 Jan 2021 09:25:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728674AbhAGRVe convert rfc822-to-8bit (ORCPT + 99 others); Thu, 7 Jan 2021 12:21:34 -0500 Received: from mail-ot1-f47.google.com ([209.85.210.47]:35148 "EHLO mail-ot1-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727673AbhAGRVd (ORCPT ); Thu, 7 Jan 2021 12:21:33 -0500 Received: by mail-ot1-f47.google.com with SMTP id i6so7000060otr.2; Thu, 07 Jan 2021 09:21:18 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=aDD1oeOdt6WCsRMuQrT0XIoTvjcM6CZh8EOY1iIY8P0=; b=K9UkUHp4SvH17A/FOsvjStS/ofKIrzjfsDw81RSCqO58tMT2WxpolvN/llViH0SEaL 9ma5HgwlgtJMiXTV0GlxWIQkOTLsLvZLjk1cyYQXnycAVlp4dvKJCEIWoLSIDpEklibl 05lHBWqklW+tn6uMsgEkSG/y6cicwGN2rmxESjwgiPQSHkSIoth9pphM1397sPNIfL9f IrwdwIK+VtPMISR4Xqa7TSarKIZ775mY6VkbscMlG0Un9OmGaJS1a1dqMnnj9UqOCwi3 PO4Q+I2EIWJXS4Pu7ZmgOy62Ptxz3oD02XH0XFPFcUqVyAJj90PN7+AaJodQ1vp9pjj+ PBOQ== X-Gm-Message-State: AOAM531zzdvJHWv0TVUiIP8EyJvVsGTgBplVPzAZT+UHfXwH1VotgR6T GPMIyChs3RlHnodn4GzFzqzA+nAKsszWdjm2iho= X-Received: by 2002:a9d:745a:: with SMTP id p26mr7561072otk.206.1610040052964; Thu, 07 Jan 2021 09:20:52 -0800 (PST) MIME-Version: 1.0 References: <20210104121053.33210-1-colin.king@canonical.com> In-Reply-To: From: "Rafael J. Wysocki" Date: Thu, 7 Jan 2021 18:20:41 +0100 Message-ID: Subject: Re: [PATCH][next] powercap/drivers/dtpm: Fix size of object being allocated To: Daniel Lezcano , Colin King Cc: "Rafael J . Wysocki" , Lukasz Luba , Linux PM , kernel-janitors@vger.kernel.org, Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jan 4, 2021 at 3:24 PM Daniel Lezcano wrote: > > On 04/01/2021 13:10, Colin King wrote: > > From: Colin Ian King > > > > The kzalloc allocation for dtpm_cpu is currently allocating the size > > of the pointer and not the size of the structure. Fix this by using > > the correct sizeof argument. > > > > Addresses-Coverity: ("Wrong sizeof argument") > > Fixes: 0e8f68d7f048 ("powercap/drivers/dtpm: Add CPU energy model based support") > > Signed-off-by: Colin Ian King > > Good catch, thanks for fixing this > > Acked-by: Daniel Lezcano Applied as 5.12 material, thanks! > > --- > > drivers/powercap/dtpm_cpu.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/drivers/powercap/dtpm_cpu.c b/drivers/powercap/dtpm_cpu.c > > index 6933c783c6b4..51c366938acd 100644 > > --- a/drivers/powercap/dtpm_cpu.c > > +++ b/drivers/powercap/dtpm_cpu.c > > @@ -200,7 +200,7 @@ static int cpuhp_dtpm_cpu_online(unsigned int cpu) > > if (!dtpm) > > return -EINVAL; > > > > - dtpm_cpu = kzalloc(sizeof(dtpm_cpu), GFP_KERNEL); > > + dtpm_cpu = kzalloc(sizeof(*dtpm_cpu), GFP_KERNEL); > > if (!dtpm_cpu) > > goto out_kfree_dtpm; > > > > > > > -- > Linaro.org │ Open source software for ARM SoCs > > Follow Linaro: Facebook | > Twitter | > Blog