mirror of https://github.com/ARMmbed/mbed-os.git
USBHost: Calling memcpy() instead of memset()?
The two following memcpy() calls in USBEndpoint::init() are passing in
a NULL pointer as the copy source location.
memcpy(td_list_[0], 0, sizeof(HCTD));
memcpy(td_list_[1], 0, sizeof(HCTD));
I suspect that these were meant to be memset() calls instead so I
switched them. In one of the places that I found where this method is
called, USBHost::newEndpoint(), its passes in an array of HCTD objects
which have already been cleared with similar memset() calls. I am
therefore pretty certain that these were meant to be memset() calls but
if all callers already guarantee that they are zeroed out then maybe
the memset()s can be removed from USBEndpoint::init() anyway.
pull/67/head
parent
8a6d5ebc34
commit
bfafd8a014
|
|
@ -27,8 +27,8 @@ void USBEndpoint::init(HCED * hced_, ENDPOINT_TYPE type_, ENDPOINT_DIRECTION dir
|
|||
|
||||
//TDs have been allocated by the host
|
||||
memcpy((HCTD**)td_list, td_list_, sizeof(HCTD*)*2); //TODO: Maybe should add a param for td_list size... at least a define
|
||||
memcpy(td_list_[0], 0, sizeof(HCTD));
|
||||
memcpy(td_list_[1], 0, sizeof(HCTD));
|
||||
memset(td_list_[0], 0, sizeof(HCTD));
|
||||
memset(td_list_[1], 0, sizeof(HCTD));
|
||||
|
||||
td_list[0]->ep = this;
|
||||
td_list[1]->ep = this;
|
||||
|
|
|
|||
Loading…
Reference in New Issue