Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp484089pxx; Wed, 28 Oct 2020 09:21:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyfWrgXeOYN6N+U8lHFlPQFPPlEC3k4Vv5Vt5DmnvLGh4NCxQAhCCdjlyI+5WFTjkuxVC1d X-Received: by 2002:a17:906:5e44:: with SMTP id b4mr8521922eju.211.1603902089439; Wed, 28 Oct 2020 09:21:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603902089; cv=none; d=google.com; s=arc-20160816; b=vfdA0215hEvW+HPN9Rr0fOHn6M2AwjNbfTk7YYAq+f+En+x3c7dhUPscAJy+RDu+bZ OOK0qKztHUVaofuQ6SpltwrCyo80/2mqaMS22VEvzI1fVXFw3yRSuoSaIBP0kH4vdGZd oIGBIABsbFTrGfSAlwm/DzjRoIB78y3i8sbduhPSwx3BdiOWodjy/Da5P5EpAJKBbAbW IL7LHx39L4KOxMg5vO0agUJcDY6ZDDWhDx4qhQbdrM/q7VH3NJnxoVzqceGm0muh6RsW Db74BtZGy58nGWdMX1bOES7tub7GTB7AwWCQvqxHKS/5WOQRd67yLCMlzjzrBQkxh7ev eysA== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Dr7vXwnrTK6JnBktDfVZ2Ht2+IPBUZCxB1WyOkZcdCQ=; b=e8zqn034mIZPfnbsI5Lmo6KUjZPnaHlIAsc6qMZ+bAS1nT6f36wVOFQv31ZiEIeBdb rKvoRvDWYj5kUJxaCJGSRE9Dzs3syW1mr5wdM4D0pWk5/KjlwCcX0KMOAx9RT07f0rV7 TqriqFt4NtPhC/9C8XW8+6acFViCYKBPdCHmYZbCVQzMqeSJDB113IsKgShscsKKnISE BGEWWv8M0ejNWMYaVjIz7DrAYqoUnNYyreG8pg9CH3IDaDaSSAwsOAAfHM8dQkY+V8B4 Rr2ReX3o4B4uaKTv4wmzXh1/q1juG9tRzQQZiPktQ/5Cqx/46S+Cc2b3vUajin2C+ayN Nxrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="bj/d5pA4"; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e13si2131229eja.305.2020.10.28.09.21.07; Wed, 28 Oct 2020 09:21:29 -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="bj/d5pA4"; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1816566AbgJ0RHh (ORCPT + 99 others); Tue, 27 Oct 2020 13:07:37 -0400 Received: from mail.kernel.org ([198.145.29.99]:40600 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2438885AbgJ0PGc (ORCPT ); Tue, 27 Oct 2020 11:06:32 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (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 0B04821707; Tue, 27 Oct 2020 15:06:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603811191; bh=vkcZ4ad6+FpfWpO3Y3LV2OvlLL+b1E9MMSne2jfsDiI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bj/d5pA4rdfa9yEBxzg0xEKX20fOZvzqEKNFXRD/S0K+diWlQVnXcmqOQh9pUwFr6 mLb2adlexj91XxkBvKfy0PvP1CeRjcp9i8C3Bb3IqEzQHkaSSYZx6SsTEzykEM1Efr Mmb7E2sxV2bEe1gCbjcDqcnWzS7ObZrsh9s9lRQQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Colin Ian King , Ira Weiny , Dennis Dalessandro , Jason Gunthorpe , Sasha Levin Subject: [PATCH 5.8 405/633] IB/rdmavt: Fix sizeof mismatch Date: Tue, 27 Oct 2020 14:52:28 +0100 Message-Id: <20201027135541.719532744@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135522.655719020@linuxfoundation.org> References: <20201027135522.655719020@linuxfoundation.org> User-Agent: quilt/0.66 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 [ Upstream commit 8e71f694e0c819db39af2336f16eb9689f1ae53f ] 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. Link: https://lore.kernel.org/r/20201008095204.82683-1-colin.king@canonical.com 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 Acked-by: Dennis Dalessandro Signed-off-by: Jason Gunthorpe Signed-off-by: Sasha Levin --- 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 f904bb34477ae..2d534c450f3c8 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.25.1