[PATCH] usb: core: Do not use sizeof on pointer type

From: Vaishali Thakkar
Date: Fri Apr 22 2016 - 01:52:31 EST


When sizeof is applied to a pointer typed expression, it gives
the size of the pointer. So, do not use sizeof on pointer type.

Problem found using Coccinelle.

Signed-off-by: Vaishali Thakkar <vaishali.thakkar@xxxxxxxxxx>
---
drivers/usb/core/hcd.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
index 2ca2cef..2aa352d 100644
--- a/drivers/usb/core/hcd.c
+++ b/drivers/usb/core/hcd.c
@@ -1386,7 +1386,7 @@ static int hcd_alloc_coherent(struct usb_bus *bus,
return -EFAULT;
}

- vaddr = hcd_buffer_alloc(bus, size + sizeof(vaddr),
+ vaddr = hcd_buffer_alloc(bus, size + sizeof(*vaddr),
mem_flags, dma_handle);
if (!vaddr)
return -ENOMEM;
--
2.1.4