Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp1445372pxu; Thu, 8 Oct 2020 11:37:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzA8yIuf8pTUGbsHrsWB563hpqxaVRiATi608nEeyDPl6cWiPzs+fYvhgMoCaWqeYvPzeXd X-Received: by 2002:a17:906:49cd:: with SMTP id w13mr9807532ejv.151.1602182274451; Thu, 08 Oct 2020 11:37:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602182274; cv=none; d=google.com; s=arc-20160816; b=gJX6PW6Mi5L+d7aJDKld6RRJj6f92R6gHCbUDfZs9d8xvXvidh+b3V8qOmLs3a1XT4 xoZ0gBADLSM/AWJGZqyFspCra6jHCeAtJ1arijEO3Jk2I7MQ2g17u6pGJBhGyylaaIFI k/4voEcFTo/VQVbpNuAIloNyB7557zX6Hk71V+hD/FrVNnhbnzv4gt7M2oyg57O2Jgfx VBW72TeD2aE4cIx36M+7ACV8RgFmsTbNdYt3o/qHN6IvWsamwTj8/fr+Dd+yTqk1lK5D hlMDRHTyTz78gtmUiQGtt1QIDS7TrTUYrvMh0W4uX3CN55mejVQ4s2U0GMT1iMqAHy0J Yisw== 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=Opb4PSQey362L9fY9+IW61l4f96AalcLofEzYZVnoJo=; b=vg0W4eDXojqHsaJEPL97ULMlh7GMaTPeJvPpQ8Pu6O44gxBENQNH0lvYWI3G2p/CHM gVX3vC47usRDHYC4uqUi/3UzHul+02tnk3E1vkPA5i2vuu6IpxEay5FfdUHUD++xKJ41 C5V400deqmE5G+xxqzVZNLXL2yj7MizFhK9tGXBqkb6ai3CDzr7+MEhOz4hQ4i2LtRT8 MecfhpCnKpIbnos40l3PHK6Dg8XC19MkkV/lf6VEowl4MC37T5Tcq9hkTQzN9ZKnzDj0 Or6qOD4CqymgUMGBdYAVZOauYUQP6qVuXO2TmSPVwV6FlkmQptv/kJ1pEezFsLbmcaDK cFxA== 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 cf16si3832524edb.540.2020.10.08.11.37.31; Thu, 08 Oct 2020 11:37:54 -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 S1731793AbgJHRLz (ORCPT + 99 others); Thu, 8 Oct 2020 13:11:55 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:35537 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727698AbgJHRLy (ORCPT ); Thu, 8 Oct 2020 13:11:54 -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 1kQZSK-0006xf-1h; Thu, 08 Oct 2020 17:11:52 +0000 From: Colin King To: Mathias Nyman , Greg Kroah-Hartman , linux-usb@vger.kernel.org Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] xhci: Fix sizeof() mismatch Date: Thu, 8 Oct 2020 18:11:51 +0100 Message-Id: <20201008171151.198996-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, sizeof(rhub->ports) is not correct, it should be sizeof(*rhub->ports). This bug did not cause any issues because it just so happens the sizes are the same. Addresses-Coverity: ("Sizeof not portable (SIZEOF_MISMATCH)") Fixes: bcaa9d5c5900 ("xhci: Create new structures to store xhci port information") Signed-off-by: Colin Ian King --- drivers/usb/host/xhci-mem.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c index fe405cd38dbc..138ba4528dd3 100644 --- a/drivers/usb/host/xhci-mem.c +++ b/drivers/usb/host/xhci-mem.c @@ -2252,8 +2252,8 @@ static void xhci_create_rhub_port_array(struct xhci_hcd *xhci, if (!rhub->num_ports) return; - rhub->ports = kcalloc_node(rhub->num_ports, sizeof(rhub->ports), flags, - dev_to_node(dev)); + rhub->ports = kcalloc_node(rhub->num_ports, sizeof(*rhub->ports), + flags, dev_to_node(dev)); for (i = 0; i < HCS_MAX_PORTS(xhci->hcs_params1); i++) { if (xhci->hw_ports[i].rhub != rhub || xhci->hw_ports[i].hcd_portnum == DUPLICATE_ENTRY) -- 2.27.0