[usb:usb-next 72/107] drivers/usb/host/xhci-mem.c:2250 xhci_create_rhub_port_array() error: potential null dereference 'rhub->ports'. (kcalloc returns null)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



tree:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-next
head:   58c38116c6cc5bcb6d952ca72111a7a15d4604a2
commit: bcaa9d5c59005eceed5f2112c13240401f0fb93b [72/107] xhci: Create new structures to store xhci port information

New smatch warnings:
drivers/usb/host/xhci-mem.c:2250 xhci_create_rhub_port_array() error: potential null dereference 'rhub->ports'.  (kcalloc returns null)

Old smatch warnings:
drivers/usb/host/xhci-mem.c:2280 xhci_setup_port_arrays() error: potential null dereference 'xhci->hw_ports'.  (kcalloc returns null)

vim +2250 drivers/usb/host/xhci-mem.c

  2235	
  2236	static void xhci_create_rhub_port_array(struct xhci_hcd *xhci,
  2237						struct xhci_hub *rhub, gfp_t flags)
  2238	{
  2239		int port_index = 0;
  2240		int i;
  2241	
  2242		if (!rhub->num_ports)
  2243			return;
  2244		rhub->ports = kcalloc(rhub->num_ports, sizeof(rhub->ports), flags);
  2245		for (i = 0; i < HCS_MAX_PORTS(xhci->hcs_params1); i++) {
  2246			if (xhci->hw_ports[i].rhub != rhub ||
  2247			    xhci->hw_ports[i].hcd_portnum == DUPLICATE_ENTRY)
  2248				continue;
  2249			xhci->hw_ports[i].hcd_portnum = port_index;
> 2250			rhub->ports[port_index] = &xhci->hw_ports[i];
  2251			port_index++;
  2252			if (port_index == rhub->num_ports)
  2253				break;
  2254		}
  2255	}
  2256	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux