Re: [Suggestion] drivers/usb/core: for u16, use stack allocation instead of kmalloc

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

 



于 2012年12月06日 19:32, Oliver Neukum 写道:
> On Thursday 06 December 2012 18:51:25 Chen Gang wrote:
>> Hello Greg Kroah-Hartman:
>>
>> in drivers/usb/core/message.c:
>>   at line 943, status is kmalloc ( sizeof u16 )
>>   at line 952, assign the value of status to data
>>   at line 953, free status.
>>
>>   it is better to let "u16 status" instead of "u16 *status = kmalloc...".
> 
> No, that would be a bug, because then we would do DMA on the stack.
> Doing DMA on the stack violates the DMA rules. Anything passed to
> usb_control_msg() as a buffer must be allocated from the heap,
> regardless of size.

  thank you. (learned)

  :-)

gchen.

> 
> 	Regards
> 		Oliver
> 
> 
> 


-- 
Chen Gang

Asianux 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