Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp197193ybh; Sun, 12 Jul 2020 03:30:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxFPVH9pvAq0pq5RJrVYlWHE3NvOoer0c6ogKb6RQZZ9F8eqVBk3pQR5yMs2+/neXhlmHgf X-Received: by 2002:a50:e1c5:: with SMTP id m5mr86102879edl.47.1594549813295; Sun, 12 Jul 2020 03:30:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594549813; cv=none; d=google.com; s=arc-20160816; b=nbdKimemaqRyYRkqlidqw7RKQ/95PhFqpo7KiUmny/tDfSjoZlOu+k3gGg9gboYpGR pyngzBlu3drrycj6GI9v1kTaGJjiAwNCpxJENKrvyPln2qJLsPAERUSM58h0Af/Dxi/4 cmHpSV5BIUjmlTLj8Vi1VyZPvtGKkdwfgH0FQ+o038lDkz+orHBI4FC3UGdUITD0iMCw og6E6Ohi0jUyu/UKpp96yXXyE7HHwS2fiOSCgGuAcp1Wvo656SZ00mIK46oSIAA9vR4Y Af6KLQ9Q+AEqU36/SvC9OQKByqVRTF6qYnsVfjUK8GiL9kWKw4ZoAylBjGuDItxQeZ09 66Nw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:dkim-signature:mime-version:message-id :date:subject:cc:to:from; bh=HueIEpf3LB7+Uj4bZJ8I5wIkAbrkHVxNkCa0Lx8Mdtw=; b=mmdDKc3AlqoDqY1rSvfsl22hv71t+tjvskqX4FuokyZr4WSMGFWvDaV4PEU9E+Hl61 t1Sev64rbr64kn7quFjdOePqrGtilpnrJfdP9J9fPhPI6C28NceNrZaKqVyoAZTb1hHw sctlJtGEz9oBKe1VxrGTdo2Jzzta29B/N9UUlP2jydlg0YjVmLnVeym+mqlynDcmkepj 6vw7am1FA20quIvEKdI3a3uBJdpkHHFPZ8SBSEpjyO/wShrrksHsQfhmEdG+CXzsGvY2 8x9b6BQobcdsHTnM4thlPFUjrKtrcIdcMt6l1+ny/DvK7jXsHAjs79AQZtShReII6tE2 ZYGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=WIFfdiO+; 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=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e20si7366046edr.227.2020.07.12.03.29.50; Sun, 12 Jul 2020 03:30:13 -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=@nvidia.com header.s=n1 header.b=WIFfdiO+; 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=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728714AbgGLK2w (ORCPT + 99 others); Sun, 12 Jul 2020 06:28:52 -0400 Received: from hqnvemgate25.nvidia.com ([216.228.121.64]:6759 "EHLO hqnvemgate25.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727777AbgGLK2w (ORCPT ); Sun, 12 Jul 2020 06:28:52 -0400 Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate25.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Sun, 12 Jul 2020 03:27:55 -0700 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Sun, 12 Jul 2020 03:28:52 -0700 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Sun, 12 Jul 2020 03:28:52 -0700 Received: from HQMAIL101.nvidia.com (172.20.187.10) by HQMAIL109.nvidia.com (172.20.187.15) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Sun, 12 Jul 2020 10:28:47 +0000 Received: from rnnvemgw01.nvidia.com (10.128.109.123) by HQMAIL101.nvidia.com (172.20.187.10) with Microsoft SMTP Server (TLS) id 15.0.1473.3 via Frontend Transport; Sun, 12 Jul 2020 10:28:47 +0000 Received: from moonraker.nvidia.com (Not Verified[10.26.75.246]) by rnnvemgw01.nvidia.com with Trustwave SEG (v7,5,8,10121) id ; Sun, 12 Jul 2020 03:28:46 -0700 From: Jon Hunter To: Thierry Reding CC: Mathias Nyman , Greg Kroah-Hartman , , , Jon Hunter , Subject: [PATCH 1/2] usb: tegra: Fix allocation for the FPCI context Date: Sun, 12 Jul 2020 11:28:36 +0100 Message-ID: <20200712102837.24340-1-jonathanh@nvidia.com> X-Mailer: git-send-email 2.17.1 X-NVConfidentiality: public MIME-Version: 1.0 Content-Type: text/plain DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1594549675; bh=HueIEpf3LB7+Uj4bZJ8I5wIkAbrkHVxNkCa0Lx8Mdtw=; h=X-PGP-Universal:From:To:CC:Subject:Date:Message-ID:X-Mailer: X-NVConfidentiality:MIME-Version:Content-Type; b=WIFfdiO+ODPanyz/TA8x1jpv4gkh85h07ufOiQcJF1wEDwdwZ78eVa5iLRj/xRHMl 8k8pC1Qp/P4ktin+Fb8GDriH9vuj2Pkucwx1OwYqXjDYzvG3qON9cJdb21UFCWPtgH 18mdTUgklWL5vGL0hIvJLdgu+ZFuB82DesB5BIBvlpExW6BN1NCX3WaVkQQsP1SMjQ rELeS5o98CRwoYLUK7tnmqoevSvX6Kd1htrYnzXzyiuUbpboPuTUguZOOuLgmxewAD 8Q3jvqphgRljoq0jVxujrxMeKY7Ed1b/Yzc44dMk+riqGWUoAilmZb/QG0AXpvTawi mAq2rugrpSKtQ== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit 5c4e8d3781bc ("usb: host: xhci-tegra: Add support for XUSB context save/restore") is using the IPFS 'num_offsets' value when allocating memory for FPCI context instead of the FPCI 'num_offsets'. We have not observed any specific issues because of this, but could cause too much memory or too little memory to be allocated. Fix this by using the FPCI 'num_offsets' for allocating the FPCI memory for storing the FPCI state. Cc: stable@vger.kernel.org Fixes: 5c4e8d3781bc ("usb: host: xhci-tegra: Add support for XUSB context save/restore") Signed-off-by: Jon Hunter --- drivers/usb/host/xhci-tegra.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/host/xhci-tegra.c b/drivers/usb/host/xhci-tegra.c index 9ce28ab47f4b..014d79334f50 100644 --- a/drivers/usb/host/xhci-tegra.c +++ b/drivers/usb/host/xhci-tegra.c @@ -856,7 +856,7 @@ static int tegra_xusb_init_context(struct tegra_xusb *tegra) if (!tegra->context.ipfs) return -ENOMEM; - tegra->context.fpci = devm_kcalloc(tegra->dev, soc->ipfs.num_offsets, + tegra->context.fpci = devm_kcalloc(tegra->dev, soc->fpci.num_offsets, sizeof(u32), GFP_KERNEL); if (!tegra->context.fpci) return -ENOMEM; -- 2.17.1