Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp1496245pxu; Thu, 8 Oct 2020 13:00:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzg6Fc5YR6xIcIqI/7Q3ZcSFyzz7EJ+Qxd4Yzm1g3DE70wiMqyUaXc1FhD8MyzpIhttDsZN X-Received: by 2002:a50:ec88:: with SMTP id e8mr6704585edr.277.1602187201366; Thu, 08 Oct 2020 13:00:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602187201; cv=none; d=google.com; s=arc-20160816; b=uYg2WqGMO5b2k52pKjpNIcKyV1eJXzL1iWXOpCiCddQnBCDyQa10Aq94DDhRfMzETT W24bAvR8R1XveVyhWJ9c/GjqBl9gVWH/wnbGr1E4Z2131PgnJja1zE570lwKOMKSI1v+ dkLkToRXuA5JnBBQNL/viJrkXxlgOKfNVK73mr9fT9Fe9lhR5I+N5UG+BQUliyC8wMMV gzs7S+LbjLiYIXyPUef9mklu1Z5WgPQrwB4Fa+mJOdMWN1nwEskrD8d/jiUm/6tmLr32 DCluZSXHi4OCyLYdtHWIAfQaGNjeCk+fNv+ocIntDiuPzOBZnfxMlxSfn7WECV8XSS6C IhWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :ironport-sdr:ironport-sdr; bh=I10+U16mXQaLiEic/qf7BYWIuIBHrfV6lcnX/6l/jsg=; b=A9rwreL2t4m4zDsQgM5utV+YJjCaA8iTILiXrNKn6KGGieGTy3JD4ifYLfypvgIDlt 2McSAVJvMLTinAEumO2IWD3PKbhPhTo+j1d2TaMqbXo4LDQOpuvQgzLlaOGjK0YZzjQq MDp6CmBLXDPhpm+3dYRfCrCwlFlbko/ZP5HNcak0vXANAy5LgMmLOll65fgKwoLEpGCn zeYPSZUN121m2k3yJWet5FpYKFgGim6hzoc+G46JydP/DdpEykj4zrUjXJczKprtc9To eeRV21zGobhgtsvWAWbTl8kor1dK4+Bx12O6s07mDLepb2+KXh8OWGGmmSUfgKT9+eT6 fU4g== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b5si4572697ejq.317.2020.10.08.12.59.38; Thu, 08 Oct 2020 13:00:01 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731372AbgJHQlS (ORCPT + 99 others); Thu, 8 Oct 2020 12:41:18 -0400 Received: from mga05.intel.com ([192.55.52.43]:21842 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726766AbgJHQlR (ORCPT ); Thu, 8 Oct 2020 12:41:17 -0400 IronPort-SDR: 7wCIG1j6ZUQCEtyKImagUxbzrnD+qgPaz1zkaoikvKQtSrszPugdzOlNEdHQ+pa8T3gS9gmpo7 XPO3eNWdV2Mw== X-IronPort-AV: E=McAfee;i="6000,8403,9768"; a="250061447" X-IronPort-AV: E=Sophos;i="5.77,351,1596524400"; d="scan'208";a="250061447" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Oct 2020 09:41:16 -0700 IronPort-SDR: +8ZEaOJS5YzgJtL53kO3bUHDLC2vYYqPW0YrpuCxHqJ65QBr+1bHZuNvQSSMvwB8l0iEn6d9ao 4DWPEcjt59zw== X-IronPort-AV: E=Sophos;i="5.77,351,1596524400"; d="scan'208";a="461870258" Received: from iweiny-desk2.sc.intel.com (HELO localhost) ([10.3.52.147]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Oct 2020 09:41:16 -0700 Date: Thu, 8 Oct 2020 09:41:16 -0700 From: Ira Weiny To: Colin King Cc: Dennis Dalessandro , Mike Marciniszyn , Doug Ledford , Jason Gunthorpe , linux-rdma@vger.kernel.org, kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] IB/rdmavt: Fix sizeof mismatch Message-ID: <20201008164116.GS2046448@iweiny-DESK2.sc.intel.com> References: <20201008095204.82683-1-colin.king@canonical.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201008095204.82683-1-colin.king@canonical.com> User-Agent: Mutt/1.11.1 (2018-12-01) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 08, 2020 at 10:52:04AM +0100, Colin King wrote: > From: Colin Ian King > > An incorrect sizeof is being used, struct rvt_ibport ** is not correct, > it should be struct rvt_ibport *. Note that since ** is the same size as > * this is not causing any issues. Improve this fix by using > sizeof(*rdi->ports) as this allows us to not even reference the type > of the pointer. Also remove line breaks as the entire statement can > fit on one line. > > Addresses-Coverity: ("Sizeof not portable (SIZEOF_MISMATCH)") > Fixes: ff6acd69518e ("IB/rdmavt: Add device structure allocation") > Signed-off-by: Colin Ian King Reviewed-by: Ira Weiny > --- > drivers/infiniband/sw/rdmavt/vt.c | 4 +--- > 1 file changed, 1 insertion(+), 3 deletions(-) > > diff --git a/drivers/infiniband/sw/rdmavt/vt.c b/drivers/infiniband/sw/rdmavt/vt.c > index f904bb34477a..2d534c450f3c 100644 > --- a/drivers/infiniband/sw/rdmavt/vt.c > +++ b/drivers/infiniband/sw/rdmavt/vt.c > @@ -95,9 +95,7 @@ struct rvt_dev_info *rvt_alloc_device(size_t size, int nports) > if (!rdi) > return rdi; > > - rdi->ports = kcalloc(nports, > - sizeof(struct rvt_ibport **), > - GFP_KERNEL); > + rdi->ports = kcalloc(nports, sizeof(*rdi->ports), GFP_KERNEL); > if (!rdi->ports) > ib_dealloc_device(&rdi->ibdev); > > -- > 2.27.0 >