All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mathias Nyman <mathias.nyman@linux.intel.com>
To: <gregkh@linuxfoundation.org>
Cc: <linux-usb@vger.kernel.org>,
	Colin Ian King <colin.king@canonical.com>,
	Mathias Nyman <mathias.nyman@linux.intel.com>
Subject: [PATCH 1/3] xhci: Fix sizeof() mismatch
Date: Wed, 28 Oct 2020 22:31:22 +0200	[thread overview]
Message-ID: <20201028203124.375344-2-mathias.nyman@linux.intel.com> (raw)
In-Reply-To: <20201028203124.375344-1-mathias.nyman@linux.intel.com>

From: Colin Ian King <colin.king@canonical.com>

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 <colin.king@canonical.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
---
 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.25.1


  reply	other threads:[~2020-10-29  2:45 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-28 20:31 [PATCH 0/3] xhci fixes for usb-linus Mathias Nyman
2020-10-28 20:31 ` Mathias Nyman [this message]
2020-10-28 20:31 ` [PATCH 2/3] usb: xhci: Workaround for S3 issue on AMD SNPS 3.0 xHC Mathias Nyman
2020-10-28 20:31 ` [PATCH 3/3] xhci: Don't create stream debugfs files with spinlock held Mathias Nyman
2020-10-29  6:03   ` Mike Galbraith
2020-10-29  9:41     ` Mathias Nyman
2020-10-29  9:42       ` Sebastian Andrzej Siewior
2020-10-29 10:23         ` Mike Galbraith
2020-10-29 10:37           ` Sebastian Andrzej Siewior
2020-10-29 11:11       ` Mike Galbraith
2020-10-29 11:22         ` Mathias Nyman
2020-10-29 11:38           ` Sebastian Andrzej Siewior
2020-10-29 12:44             ` Jun Li
2020-10-29 13:08             ` Mathias Nyman
2020-10-29 15:10               ` Sebastian Andrzej Siewior
2020-10-29 16:26               ` David Laight
2020-10-29 17:43               ` Sebastian Andrzej Siewior
2020-10-30  8:01   ` Jun Li

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201028203124.375344-2-mathias.nyman@linux.intel.com \
    --to=mathias.nyman@linux.intel.com \
    --cc=colin.king@canonical.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-usb@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.