Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp258616pxk; Thu, 17 Sep 2020 02:09:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzdhQdlus6sIu6KBJ1B4At/9pdTASVjwWa0V2B92IaVf9FEQxd7uzqCVwtAueKw70suMM+n X-Received: by 2002:aa7:d747:: with SMTP id a7mr30883547eds.304.1600333792404; Thu, 17 Sep 2020 02:09:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600333792; cv=none; d=google.com; s=arc-20160816; b=aTmtoL338hXACr6NH13yw5F2Qpqrj80pNt7iGuPZFAUuFmMyzgLGdWymwCUWXsZeS/ DhcsRD/tMyMKpmUFhvPjB08yo1xA0Cek4cdNXyCN6RnbTLmmT2UToXUXNKRjIAmQpMrA tlitPa0IQQ+vKO7S5oowmtX8uX0x3vS0f/cgRymPLbdIh0C9STdfIlHafvAb4G1FTj9t c6X4fIHGcmLt5AThf/n3GlEjRfNAOK6ZDpE/+98p4bHcky/GkZZU9IUxQPc7/RGH9Df/ 1O2hOgWxqlfwuwDgETyUnNDuVAd4rwMU/yUXXeAFkWGaTVDPLPypDeqI7lIyCP2CzSow jOJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Syg9/0/aFSrYjEErc6h3TrqehVClsX+BLqQ9ujtzapA=; b=Eqmy/hegbiOAKEKIhOq7wMuqUvPbwakXCrhLwgalR3+KXtISOqUsh6ZSt6kB0XPT3V VrdUlTCWnREsYC8VFjnhhbl4pXLIQPsbDDW1TGAhanRf6xOk9N/yP2sNIBEsDNKnRKsd FgIoPR/VSU4QPZ7RsRWSswWdhVeTlvb13+KUyi5DziCOycsJ5/OLU+7qFK5kkRKQKSJY /NbPkcZ6WeVQaxhMbfE76ymOjgUggeDuyrXeaPwXPyS1/TqI0/x6pEzpct6Ww+0rFSSV xnQIHDA91KWtlLumJs8ecwF+j+MPCGLKwd1Y/bzkzqk5HTqMxrdYD4K4lKNcLzzBbwSj TQVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ol5WmhOv; 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 rh6si13202221ejb.709.2020.09.17.02.09.27; Thu, 17 Sep 2020 02:09:52 -0700 (PDT) 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; dkim=pass header.i=@kernel.org header.s=default header.b=ol5WmhOv; 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 S1726382AbgIQJIQ (ORCPT + 99 others); Thu, 17 Sep 2020 05:08:16 -0400 Received: from mail.kernel.org ([198.145.29.99]:50630 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726211AbgIQJIP (ORCPT ); Thu, 17 Sep 2020 05:08:15 -0400 Received: from localhost (unknown [193.47.165.251]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D62CD20795; Thu, 17 Sep 2020 09:08:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600333694; bh=71PMMX4XGwzhcDucaMkdKJC5uGHv8NBRfWU+pcx17cw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ol5WmhOvI9rTFHgy8Vm01a+xGvI5mfTv9WBhdwoiPyKDHFLe79b8dV4Xg94ovNSEm s9uxKgsVD6kfIu4LtqFnl7Ad+hw1A3xZll7LH8LyHueKNgIMhX6DA30mCajLlPMYz4 astP5egLtpksNLrkl+aUOBY16OorzupdIFOwmpj4= Date: Thu, 17 Sep 2020 12:08:10 +0300 From: Leon Romanovsky To: Liu Shixin Cc: Doug Ledford , Jason Gunthorpe , linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH -next] RDMA/mlx5: fix type warning of sizeof in __mlx5_ib_alloc_counters() Message-ID: <20200917090810.GB869610@unreal> References: <20200917082926.GA869610@unreal> <20200917091008.2309158-1-liushixin2@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200917091008.2309158-1-liushixin2@huawei.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 17, 2020 at 05:10:08PM +0800, Liu Shixin wrote: > sizeof() when applied to a pointer typed expression should give the > size of the pointed data, even if the data is a pointer. > > Signed-off-by: Liu Shixin > --- > drivers/infiniband/hw/mlx5/counters.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/infiniband/hw/mlx5/counters.c b/drivers/infiniband/hw/mlx5/counters.c > index 145f3cb40ccb..aeeb14ecb3ee 100644 > --- a/drivers/infiniband/hw/mlx5/counters.c > +++ b/drivers/infiniband/hw/mlx5/counters.c > @@ -456,12 +456,12 @@ static int __mlx5_ib_alloc_counters(struct mlx5_ib_dev *dev, > cnts->num_ext_ppcnt_counters = ARRAY_SIZE(ext_ppcnt_cnts); > num_counters += ARRAY_SIZE(ext_ppcnt_cnts); > } > - cnts->names = kcalloc(num_counters, sizeof(cnts->names), GFP_KERNEL); > + cnts->names = kcalloc(num_counters, sizeof(*cnts->names), GFP_KERNEL); This change is correct. > if (!cnts->names) > return -ENOMEM; > > cnts->offsets = kcalloc(num_counters, > - sizeof(cnts->offsets), GFP_KERNEL); > + sizeof(*cnts->offsets), GFP_KERNEL); This is not. > if (!cnts->offsets) > goto err_names; > > -- > 2.25.1 >