Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp888883pxk; Thu, 17 Sep 2020 20:25:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwy6Shpvu0tczKPCE6t0DpZXzVeuF6+WQBgdBZN5xhm9GO9T9uMguOuvq21g35v16I526Oo X-Received: by 2002:a05:6402:220d:: with SMTP id cq13mr35959070edb.260.1600399520155; Thu, 17 Sep 2020 20:25:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600399520; cv=none; d=google.com; s=arc-20160816; b=pe1BLCqfAmXRxxD60o8LqAkgTYNd9zi6667RpNJcabMiDQnbB6omAdzqlvszKWlSKY PBFmBx3PDZQTKoNDY9zMQC7RUuLk/E3JgWmRyErWtBckP8xc2+2x0oRswLyuAbIYTlja 9eweMxLGgv00J94Oepki0PVX6W7RCFDDY/XqvymAMRY8ERS942OQPRDVDlyXN4WPL9nZ FDRGChgbsxBVN7zEL9QZIIzZHwGsZqTlo6Br3abtwy7O92o2Hp9ZlyhZSesjBQ3HUN2+ GTQP1W6Vy9MrmG3mu7ock7iwhthT00UIFBTU62Y+ogLT9Tw8jw+EfnkHf94BDh7608u5 UTvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:cc:references:to :subject; bh=z8nS0gLZzkZNGwWvBY+W4HFRdHwc/pMR6JjUMrz3TIA=; b=VYKBhNzqaxUTfXV+HK10sbuodZuaXs0m7sZ2qlbc8ZoQ//tdfikfEhIa9xuw8Zszb6 pLQlpss9RWTwqe7emvmO65u0ZN43Vzku/tmspZLxy588SE/6sr2QQSXx5UNphTGonGth OakEYqFOTouGGyYbexKOmk2tt2A3Sk6bd29UYr/81EFb14L1iWXht010VZHMThnjjSNc /PTIbFN3lKW1jzlmH/sfgOAQ3Sbv6hjc+ZtugTWUVKCQW2ifBaAgVopqmjXf94JhSmVj JiJ8QGU5hBMHCOI9c/i8TlXUAhxjDsrZwmNRiypUy8hV3wp8xj+dqqYdkxFSeBVx4xAr 4/Gg== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n16si1564209ejd.256.2020.09.17.20.24.57; Thu, 17 Sep 2020 20:25:20 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726218AbgIRDXY (ORCPT + 99 others); Thu, 17 Sep 2020 23:23:24 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:40604 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726121AbgIRDXY (ORCPT ); Thu, 17 Sep 2020 23:23:24 -0400 Received: from DGGEMS412-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 65EED8DBBF3B60304858; Fri, 18 Sep 2020 11:23:22 +0800 (CST) Received: from [10.174.177.116] (10.174.177.116) by DGGEMS412-HUB.china.huawei.com (10.3.19.212) with Microsoft SMTP Server id 14.3.487.0; Fri, 18 Sep 2020 11:23:19 +0800 Subject: Re: [PATCH -next] RDMA/mlx5: fix type warning of sizeof in __mlx5_ib_alloc_counters() To: Leon Romanovsky , Jason Gunthorpe 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> CC: Doug Ledford , , From: Liu Shixin Message-ID: <59dfb43f-04a7-b02a-1619-81d92ca69278@huawei.com> Date: Fri, 18 Sep 2020 11:23:18 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.7.1 MIME-Version: 1.0 In-Reply-To: <20200917173346.GK869610@unreal> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.177.116] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. > >> Jason > . >