Преглед изворни кода

use forloop to avoid -Warray-bounds with host setup packet

hathach пре 3 година
родитељ
комит
25580b4fe9
1 измењених фајлова са 4 додато и 5 уклоњено
  1. 4 5
      src/portable/raspberrypi/rp2040/hcd_rp2040.c

+ 4 - 5
src/portable/raspberrypi/rp2040/hcd_rp2040.c

@@ -563,11 +563,10 @@ bool hcd_setup_send(uint8_t rhport, uint8_t dev_addr, uint8_t const setup_packet
     (void) rhport;
 
     // Copy data into setup packet buffer
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Warray-bounds"
-#pragma GCC diagnostic ignored "-Wstringop-overflow"
-    memcpy((void*) (uintptr_t) &usbh_dpram->setup_packet[0], setup_packet, 8);
-#pragma GCC diagnostic pop
+    for(uint8_t i=0; i<8; i++)
+    {
+      usbh_dpram->setup_packet[i] = setup_packet[i];
+    }
 
     // Configure EP0 struct with setup info for the trans complete
     struct hw_endpoint *ep = _hw_endpoint_allocate(0);