Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp1219573pxx; Tue, 27 Oct 2020 11:02:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxt/VoLrcqUJUuOs+Qcw29+9cwECu/R1H64zZUI1gtR7BjfZCQPcldFKhBEYeGn03YQh3Bf X-Received: by 2002:a05:6402:6d8:: with SMTP id n24mr3565190edy.168.1603821730051; Tue, 27 Oct 2020 11:02:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603821730; cv=none; d=google.com; s=arc-20160816; b=MU8Ggx/tjoEE7uOUgCr1Yerk9UaSdtnHk0Zv5CPXzZoNbwppLmu/N5ZPnjWPB4AzPg mDIdMXo5GIpD/p2VSshDj1C7SaFtPOY8A3XghkJXwlATZa8Yr3088emZFe1PegxZ60yd RLo2fYsdUPxUelabrqaf8TVy3sXMoc5dioS1zRjmfMtHyNYs/bppW8nS5eTV803YUu4e RaNJgcZ6yHu5b+UvdHmOfg21Pf39eMBsO5tojVTonkoQiSvO5wD5oX4/e13NMVHGtK45 WzRQpO7v54QqHW+TGxqd8ZcWpv9kQvbf/FkeBOZBMILd0LpYh7M34HCEnldMLT8EePwW uKbA== 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=qhMob0aVFsSqBjiR7Pwvr2g3B+8yo3JkpVemHd/q+Lk=; b=Vzxf2F6jesza5SIrW38fDUNz/7J6WcT2/d+VR9d5oJWtqzOF4y+ANh9UYVwi7pY069 Q2YThI7Pq79QvERNO5KSPBh8yA4OWhZAzqgSdSxYzZE5nZW+aQkeTUvY+1lN8FUf5s67 IKQdEVAfDmRv0byHrTr2Hvd+PEbloycTZILldOr0ciT7kIo1xzNZaA2TXjnRciPpN1Hi Ovcp4h4BlhCSOLDqAhs/apepUiplVovf2ESDWiPkS9C2k746Xmj/BHdU5KPleZC7/HVM CwnEy/st1QfeRVS2tcc/2PtHm8cF9njskxvehuBhp3XTLO2iKi1NdXlsXmHeB56ZClGZ 0TOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=CBt+6CVI; 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 l13si1672227ejg.735.2020.10.27.11.01.47; Tue, 27 Oct 2020 11:02:10 -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=CBt+6CVI; 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 S1820195AbgJ0Rdp (ORCPT + 99 others); Tue, 27 Oct 2020 13:33:45 -0400 Received: from mail.kernel.org ([198.145.29.99]:40406 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2899411AbgJ0OlD (ORCPT ); Tue, 27 Oct 2020 10:41:03 -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 D2BD3207BB; Tue, 27 Oct 2020 14:41:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603809662; bh=jU8o96p+Azhs7l6diBcY7C8cg10KAEjX8Z2zohcalTQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CBt+6CVIwL1ReqS+nI4T8YBV8+izYliGfahjBf0w7eiNhU7PesQRo3CxqubmJ4PLq RMMf7v0mQ68V6iYFYmhz2pJdC1sj03ZEcyoKTmUiO8Tgwg6ArF3YV98MDr8Dn2+A8w Zkx+xSw2yOAmKzOMvxpw4HMeeajPQucLsCcfRWmQ= 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.4 248/408] IB/rdmavt: Fix sizeof mismatch Date: Tue, 27 Oct 2020 14:53:06 +0100 Message-Id: <20201027135506.567543608@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135455.027547757@linuxfoundation.org> References: <20201027135455.027547757@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 18da1e1ea9797..833f3f1b87f5e 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