net/ptpd: fix compile warning issue

In some scenarios, dynamic memory allocation is not allowed, so it is modified to a static allocation method.

Signed-off-by: gaohedong <gaohedong@xiaomi.com>
This commit is contained in:
gaohedong 2025-07-07 22:41:19 +08:00 committed by GUIDINGLI
parent e804886c68
commit 54bef649ea

View file

@ -758,11 +758,13 @@ static int ptp_sendmsg(FAR struct ptp_state_s *state, FAR const void *buf,
0x01, 0x80, 0xc2, 0x00, 0x00, 0x0e
};
char raw[sizeof(struct ether_header) + buflen];
char raw[sizeof(struct ether_header) + sizeof(struct ptp_announce_s)];
FAR struct ether_header *header;
struct msghdr msg;
struct iovec iov;
DEBUGASSERT(sizeof(struct ptp_announce_s) >= buflen);
header = (FAR struct ether_header *)&raw;
memcpy(header->ether_dhost, ptp_multicast_mac, ETHER_ADDR_LEN);
netlib_getmacaddr(state->config->interface, header->ether_shost);