Skip to content

Commit 25580b4

Browse files
committed
use forloop to avoid -Warray-bounds with host setup packet
1 parent 9c56f70 commit 25580b4

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/portable/raspberrypi/rp2040/hcd_rp2040.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -563,11 +563,10 @@ bool hcd_setup_send(uint8_t rhport, uint8_t dev_addr, uint8_t const setup_packet
563563
(void) rhport;
564564

565565
// Copy data into setup packet buffer
566-
#pragma GCC diagnostic push
567-
#pragma GCC diagnostic ignored "-Warray-bounds"
568-
#pragma GCC diagnostic ignored "-Wstringop-overflow"
569-
memcpy((void*) (uintptr_t) &usbh_dpram->setup_packet[0], setup_packet, 8);
570-
#pragma GCC diagnostic pop
566+
for(uint8_t i=0; i<8; i++)
567+
{
568+
usbh_dpram->setup_packet[i] = setup_packet[i];
569+
}
571570

572571
// Configure EP0 struct with setup info for the trans complete
573572
struct hw_endpoint *ep = _hw_endpoint_allocate(0);

0 commit comments

Comments
 (0)