Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3146000pxk; Mon, 21 Sep 2020 06:27:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwW9m8d9YbruTCMEGL+cUE4kVZs+EnSIdK3X+987wEtieyvCaqtfva5RpYrFXj+/il7t+3k X-Received: by 2002:a50:bb65:: with SMTP id y92mr51879822ede.53.1600694870397; Mon, 21 Sep 2020 06:27:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600694870; cv=none; d=google.com; s=arc-20160816; b=pUZrDj+W0M+/j/JLCcRhkh0tCXsSi5GcFI2UQAcS1rrlx8TMIoAwRC1V8Po0KEToX5 m+Mxp4ju+wBN8hnH5UJRaoMqwtFdtoRigD0ZW0K6Z2oxtp0IqgU9qJGfoznpWlMuT+uv k5uUkpWZz8rlqnuxVVre8iX/OvdyyEpdoJuSVJUDThL/JhJgUVA2ouGm74xwoMIFS22U psJ4D0BSzDwoKMBGKmMrSFkW1zDGWNPmnqY4lWb8I+ImAfF4mgGohTzDMFFq9RTMrYOs f0wABp2jVmZI+OPanpAPTGYX/blFqDzu7F4LZ4PSD08fpaM5gO0JjrnsFRzKS0plbHY2 Auig== 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=Bh7ZncIiChpulmTze5wYZYY5Px1gEwSqFpTGKkUQ8Xg=; b=sQ5Ev2scvnDMtTiW39MfWvbt4Ef8cAv1acmROskW/+EHYKr6W4Obo02WEuYVbF8N2y heRFfu4O31eoOG33LfVYcVAXz6CYu4Hz8lokzJrrdqV0AsH4ACHty4ShPDuXAv1PLL2N 0KeGAevSAweAoq8n9cpOslU/ONFLlxqnxxN1/okgAadK6UK4CWr4EPgku96uMkbIpfT6 xjfCKuji0zympYa+0OvPg2GQzI9BB8JHdzs16ly5H983yPYdCJBCOhC6whQsKejj/ylh oabVnKYji/kInatERLlUj6BY30jlAj+7OzSsCgS7I2MIAEdWtJqn2trg8lBnmRMcbTBo Bqgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=xjmubhzU; 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 by2si8117308edb.324.2020.09.21.06.27.27; Mon, 21 Sep 2020 06:27:50 -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=xjmubhzU; 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 S1726767AbgIUN0N (ORCPT + 99 others); Mon, 21 Sep 2020 09:26:13 -0400 Received: from mail.kernel.org ([198.145.29.99]:48018 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726436AbgIUN0N (ORCPT ); Mon, 21 Sep 2020 09:26:13 -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 4818120708; Mon, 21 Sep 2020 13:26:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600694773; bh=tTWlCLjvuo1tJvYphh7kj/Nq4AvZMFZvnyz0oLuf/j8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=xjmubhzU5xJnmDIB15vYqI+Q/KIwbET6YFMDxXEBcBn7irb3hplACALO32oevYLoC toWXE/ib2N3ZoepvP0X+w05sqW/Y6g8beQTBPOXrTLDJY0hTSpwwK6ACj9G5TjyzlE lgCwdz2b9RhuqxfhTmyncCaTSuiDhhQ7o4hingTo= Date: Mon, 21 Sep 2020 16:26:08 +0300 From: Leon Romanovsky To: Liu Shixin Cc: Jason Gunthorpe , 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: <20200921132608.GD1223944@unreal> References: <20200917082926.GA869610@unreal> <20200917091008.2309158-1-liushixin2@huawei.com> <20200917090810.GB869610@unreal> <20200917123806.GA114613@nvidia.com> <20200917170511.GI869610@unreal> <20200917172451.GK8409@ziepe.ca> <20200917173346.GK869610@unreal> <59dfb43f-04a7-b02a-1619-81d92ca69278@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <59dfb43f-04a7-b02a-1619-81d92ca69278@huawei.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Sep 18, 2020 at 11:23:18AM +0800, Liu Shixin wrote: > On 2020/9/18 1:33, Leon Romanovsky wrote: > > On Thu, Sep 17, 2020 at 02:24:51PM -0300, Jason Gunthorpe wrote: > >> On Thu, Sep 17, 2020 at 08:05:11PM +0300, Leon Romanovsky wrote: > >>> 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 *". > >> Then why isn't a pointer to size **? > >> > >> Something is rotten here > > No problem, I'll check. > I think cnts->offsets is an array pointer whose element is size_t rathen than pointer, > so the patch description does not correspond. > And I think it should be modified to sizeof(*cnts->offsets) with other description. Sorry for me being wrong, you are right. Thanks > > > >> Jason > > . > > >