Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp625607pxk; Thu, 17 Sep 2020 11:39:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxn+ojpUznOyepPgua4cv2G0XpfwMH80GBAdEZqy4JL9u67RqAX2MhqLfJV/jEmEvs8OzAx X-Received: by 2002:aa7:c648:: with SMTP id z8mr34945642edr.239.1600367966615; Thu, 17 Sep 2020 11:39:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600367966; cv=none; d=google.com; s=arc-20160816; b=UiP90HVQln3gX0tGo8pQ1k3Oi4wx3tVivF/LP+x1VvNcr3Hbf+izaPhvE/lfB99AF0 MkdmMU02cOoHOHH/oN2pXFL5rTriIvq8N7DeWdYTyA2kp3DKN+vnplMFYxjskuE2KkRX Y7BWkVcJ0o6FwZZGyBMMJgviiHk30yTlqTStZLmeXZ/cO6k+TF9uA2bu82aWqbU0ANcQ x3UrpcNbSB5OxLFm/js0Qo842OFAV8wQn9NkoKtDlqfTbMfziqSDCv4VJeWCtjgKPOnI yAbXQwmkfj7359ejkG5fMHO92rNcqy8PXPkJVsI/ssocGau4KlIqvtNRWpzBDNuKTU9Q 5Wzw== 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=qnISMbW3nm4yggbOBgqyVMEyiRIror+WZEAjWJm/K2g=; b=QR5Up8OgyRGURGN7e89+mYr2bvAmpEFOcyDFfCYStSjoiDnRWTfAe7QNMU0rfsBtfz 0OejZuR8PkICnirXKlflt/cddQK1jS+KBhZbhRpzH9+yl2Zt0DeOTuW6P10g/IS75oeC ZzBFHuTpcDj0T8nWen28jrpf7lIOdZc3DfbEjPiNdjNeUJsKwBt6SfZVJ2BCgBU8p9c0 nUwQBzDPkyaQFHIHu0bdq9VLOKvYVXK8s1xCLsZR8Nunl7Sfjr9EGbuzHhp+K6t+5AFK CdJphZ42uzW/eP4jLtHlXcTGYP7GhC9jekvoHEyUaQzuJH4754wWlxcq5eHWjUOjl+S2 mGLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=FgfHEC+p; 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 c21si389979edw.18.2020.09.17.11.39.03; Thu, 17 Sep 2020 11:39:26 -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=@ziepe.ca header.s=google header.b=FgfHEC+p; 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 S1726447AbgIQRZo (ORCPT + 99 others); Thu, 17 Sep 2020 13:25:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58182 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726318AbgIQRZK (ORCPT ); Thu, 17 Sep 2020 13:25:10 -0400 Received: from mail-qv1-xf43.google.com (mail-qv1-xf43.google.com [IPv6:2607:f8b0:4864:20::f43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E2CB8C061756 for ; Thu, 17 Sep 2020 10:24:53 -0700 (PDT) Received: by mail-qv1-xf43.google.com with SMTP id z18so1373643qvp.6 for ; Thu, 17 Sep 2020 10:24:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=qnISMbW3nm4yggbOBgqyVMEyiRIror+WZEAjWJm/K2g=; b=FgfHEC+paMaduo6pBiGfkE6HvXXKKjAXDfribiWG8g4jTuepijvRaEFw+U+dfXI5oo OJL4xOE4CizfEM/4FWvJAG4beepZ2VRh626USUpegbA0MWIvyPkWb1ogt8sXzndhQEfV 5FV6VLMO4GQ2Zvzwu9bdBiiY9SrU1s9ehrpmJcZD8t23FjgQ61jVLKYlaXgdUBeSK/cB DAnDPvvilysMmI7oWRL+vD4bEodstP5lgTEHQFP/Ut0ngu0vMuhDk99Q8bVXK5rcR1tg 0mFZeVCzJJrRJD+5LBgOQRWQKsloBbweX4HVZaSGNEPEa7phLjn0k5d3jKDAQQ0NF/r1 3YZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=qnISMbW3nm4yggbOBgqyVMEyiRIror+WZEAjWJm/K2g=; b=nIjzTrzdmxcMqQc7dqZntogpa9t2jAQoQGtRyd+uUxMj/MKmeJGrhUujF74ZnWS1qW ipWd/lwy/ys7RLouFPnbx0hPZBVb+4/OSUaLK4peyMOfkLMIqRQG9/UdL5g+b5JX1Uzu ZsmMwl+QFPCZ199woWPv1aM/EGqmBCRCwSXJquvNXEQyis8XtcZPEpWyVat4eHLvAXvz 0O7Lp/pSN3sBGs850ub5P2knfKBKWzb2ETBcOuOQ52SsERK24BFzWSGszJIjGUC0Vsls sSIyfkSYyKapYi3Zrmeb+uh5igBvVxHB1TTMB2qvggF1VQpoZXaXBEnk20UetuzWc5NV tEVw== X-Gm-Message-State: AOAM530p/7+kFkruBOaW7rLqfjWf7mwLdaVQ/PN9ht6HbhYcLRqXI4AR 6o9XRcqbFHtrDtrUDJhUUDFTfw== X-Received: by 2002:a0c:a990:: with SMTP id a16mr12961214qvb.59.1600363493126; Thu, 17 Sep 2020 10:24:53 -0700 (PDT) Received: from ziepe.ca (hlfxns017vw-156-34-48-30.dhcp-dynamic.fibreop.ns.bellaliant.net. [156.34.48.30]) by smtp.gmail.com with ESMTPSA id o26sm254821qtb.24.2020.09.17.10.24.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Sep 2020 10:24:52 -0700 (PDT) Received: from jgg by mlx with local (Exim 4.94) (envelope-from ) id 1kIxeN-000akx-Ni; Thu, 17 Sep 2020 14:24:51 -0300 Date: Thu, 17 Sep 2020 14:24:51 -0300 From: Jason Gunthorpe To: Leon Romanovsky 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: <20200917172451.GK8409@ziepe.ca> References: <20200917082926.GA869610@unreal> <20200917091008.2309158-1-liushixin2@huawei.com> <20200917090810.GB869610@unreal> <20200917123806.GA114613@nvidia.com> <20200917170511.GI869610@unreal> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200917170511.GI869610@unreal> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Jason