Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp1083701pxu; Thu, 8 Oct 2020 02:55:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwxe0tzM/fqIjDqGs9YiFXtYiwbTwctAQ+2L5JqI/98PcdJCB+Ezku5xLrO42XfUBx9BeSm X-Received: by 2002:aa7:d690:: with SMTP id d16mr8248652edr.301.1602150909797; Thu, 08 Oct 2020 02:55:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602150909; cv=none; d=google.com; s=arc-20160816; b=sQxXZ3lwwPO75Ya1IUtagEUp+NJAUGxxbgMzzH7OmW9Q9Vn+rNCouZkb7/kcQ8/+aP 5sJmY7Q1k2RrlW3ESHICrC8yE0tf6uBfLm3A2dbhwzTa1Y5APiT4OO88ih7SF/5mgBkd bpyecm5fz9ukI+1uiEE0G5l6iDUH1tAjtlD2WkxSYKvdTp9zRE9nslVz8lUqAiUVXeI8 2WDi+lOlqyx9GVPGucYcrRnfKepqKI2oGfCuyRhRVuVjEPMM/5lXsyIGsH7slT1Sv56s gl6xTc4+6WhL1M29zG0cG/s6dHB5feFlUJaQ4iOiHbAW2HwbKm1GZnfPWzT0KdAevI1k 4hSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=6RMYpX0tDheAL5mBWjxJpYcCSyuLshhQiPjJklRt+5A=; b=SC6orXT4swjaRCn04GYhN+l13Uz7PYJJecXf5ALcmZ6VayygnFg46duSnbVcfObwm5 UChDO+avYtxrdtc5Cvsq8+IT6IDSihgni3IU4E92K1wgu1KmSs3Nr8PUiphPi6tFbWt4 FOvHZ+zjihDy5Z4NFGKExcmxwPnxlzBwSEWRPhh0oLMrAWTB2p3hnxCOsPz/BtTv/On9 hOLCRUk1OGhha0vy3HhEiWK5KFwxBZIAoCmLAjLVyIGQX8i8m7pLE9RZuTDah0sEQ00D 4Vd/oXJkp0SYSU0rjxrlXwJcLPYRjBapzKtuEYPtAtb0HhEBQkQSkkICa9W8Ogy8LFV4 fodA== 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=canonical.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q13si3213787edb.308.2020.10.08.02.54.46; Thu, 08 Oct 2020 02:55:09 -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=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729276AbgJHJwJ (ORCPT + 99 others); Thu, 8 Oct 2020 05:52:09 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:49078 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725916AbgJHJwJ (ORCPT ); Thu, 8 Oct 2020 05:52:09 -0400 Received: from 1.general.cking.uk.vpn ([10.172.193.212] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1kQSaj-0008Tm-3D; Thu, 08 Oct 2020 09:52:05 +0000 From: Colin King To: Dennis Dalessandro , Mike Marciniszyn , Doug Ledford , Jason Gunthorpe , Ira Weiny , linux-rdma@vger.kernel.org Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] IB/rdmavt: Fix sizeof mismatch Date: Thu, 8 Oct 2020 10:52:04 +0100 Message-Id: <20201008095204.82683-1-colin.king@canonical.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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