usb-standard: fix alignment assumption for Cortex-M0 platforms

This commit is contained in:
Sebastian Holzapfel 2018-02-11 09:39:55 +11:00 committed by Karl Palsson
parent d79674db09
commit f871e539ed

View File

@ -129,8 +129,9 @@ static uint16_t build_config_descriptor(usbd_device *usbd_dev,
}
}
/* Fill in wTotalLength. */
*(uint16_t *)(tmpbuf + 2) = totallen;
/* Fill in wTotalLength.
* Note that tmpbuf is sometimes not halfword-aligned */
memcpy((tmpbuf + 2), &totallen, sizeof(uint16_t));
return total;
}