Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp567065pxk; Thu, 17 Sep 2020 10:07:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyjGm/VQhmwWel84BEl0EC4kqC+xmXWAVORvfCH4K7kSGBlY7rK85CBPwRKuJJ1GMSE1RJf X-Received: by 2002:a17:906:71c9:: with SMTP id i9mr31172078ejk.250.1600362439388; Thu, 17 Sep 2020 10:07:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600362439; cv=none; d=google.com; s=arc-20160816; b=OaUHGovQPtAOnEfBxAi+QwX88O7rm4Sfbfj7so3zpff8y1OEOTQh+oHe/BJEwAMoEL IPRngrMPX1WhAusjFzvaio6rQcUPdPCPMGoRHVLljBq2UUsnYLLs/AJpBQ3BYL+xanrf vM2NjHQHxzpW4rQHLAiPyY0IgNxZZNY/loPjTe+6bNL4rnuEJTPYC+V4mCbFGZS+jAb5 YHou59zY1ywBiYK/a8tb0kWkSOaFhvLTt9YwO6RhgR1VWDuTgRIfmIfJQ4j3erHKotnL NUCqE/JHcfWuvgHkGtdL/LZm1CAuwl/xIpYF/WuRxAqPO+kQGaeviAVfCirnwLki+PH/ AXXw== 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=1fdIDQZCjQGwf5Hb3fx7DKDTtTA4vLq7R9ugPHkiYQI=; b=GjnL8zFx1Of9RsgoFws3O5As9DDfpYBx5U5LxH4OoUJCSef7LTo8X2l5+xip0HUOb2 34gTNiBAC9eU0G8bptBM4sr+BMf41DhlDyeqQnPRROzfzoaJIEyCq64ro2EnClQOlE0r /vaFq8RVDfVSNAfYnkt0cVkagsb87NV+1CsJ94WsyTHdwbbDjLa0pfc16+e58K8ePfpQ dxu6zOOAKZDgawURqAkaDmh5fIuBxRPj4g7k3SEBjSAkm9/HyS7If7eFz+ehSwI5NTvY pKUWMiO4KqR0/mNo+RwsWJeV7AWouwz5gv7fb8HbTtr0oKJ5kA56tzD2t1yjbNC14v37 BNUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=SRY3EW1S; 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 ay26si203073edb.269.2020.09.17.10.06.55; Thu, 17 Sep 2020 10:07:19 -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=SRY3EW1S; 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 S1726786AbgIQRFs (ORCPT + 99 others); Thu, 17 Sep 2020 13:05:48 -0400 Received: from mail.kernel.org ([198.145.29.99]:48678 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728074AbgIQRFQ (ORCPT ); Thu, 17 Sep 2020 13:05:16 -0400 Received: from localhost (unknown [213.57.247.131]) (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 8D1CD206A2; Thu, 17 Sep 2020 17:05:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600362316; bh=4vDvtVqStZPJ5PaYsrsuay+CwsikfXiFuhGtIVFY3jk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=SRY3EW1SudaDv4PvQXVJP8XxnFJqM1+CepkkECdh20VgjeIEVjfooGkbiCzgQYZme dgQvpUtH+niQBVne10rH849paQ6qS7hM6KbYvkvnFb/cNZoDUI5nWYXsIJTnkDWp9t LHVaTWdy9fgq5DaUHfEWeXM21L4q5e5PLFJP82aA= Date: Thu, 17 Sep 2020 20:05:11 +0300 From: Leon Romanovsky To: Jason Gunthorpe Cc: Liu Shixin , Doug Ledford , 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: <20200917170511.GI869610@unreal> References: <20200917082926.GA869610@unreal> <20200917091008.2309158-1-liushixin2@huawei.com> <20200917090810.GB869610@unreal> <20200917123806.GA114613@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200917123806.GA114613@nvidia.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 17, 2020 at 09:38:06AM -0300, Jason Gunthorpe wrote: > On Thu, Sep 17, 2020 at 12:08:10PM +0300, Leon Romanovsky wrote: > > 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 > > Needs a fixes line > > > > if (!cnts->names) > > > return -ENOMEM; > > > > > > cnts->offsets = kcalloc(num_counters, > > > - sizeof(cnts->offsets), GFP_KERNEL); > > > + sizeof(*cnts->offsets), GFP_KERNEL); > > > > This is not. > > Why not? cnts->offsets is array of pointers that we will set later. The "sizeof(*cnts->offsets)" will return the size of size_t, while we need to get "size_t *". Thanks > > Jason