Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751840AbcDVFw2 (ORCPT ); Fri, 22 Apr 2016 01:52:28 -0400 Received: from userp1040.oracle.com ([156.151.31.81]:22686 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751067AbcDVFw1 (ORCPT ); Fri, 22 Apr 2016 01:52:27 -0400 From: Vaishali Thakkar To: gregkh@linuxfoundation.org Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Vaishali Thakkar Subject: [PATCH] usb: core: Do not use sizeof on pointer type Date: Fri, 22 Apr 2016 11:21:50 +0530 Message-Id: <1461304310-4808-1-git-send-email-vaishali.thakkar@oracle.com> X-Mailer: git-send-email 2.1.4 X-Source-IP: userv0022.oracle.com [156.151.31.74] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 735 Lines: 25 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 --- 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