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

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

 



Vaishali Thakkar wrote:
> When sizeof is applied to a pointer typed expression, it gives
> the size of the pointer.

And why would that be wrong in this case?

> +++ 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;
>

Please note the following comment:

	/*
	 * Store the virtual address of the buffer at the end
	 * of the allocated dma buffer. [...]


Regards,
Clemens
--
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