From aaeffe5b7064536dc7f4ea75a58125ec69d2706b Mon Sep 17 00:00:00 2001 From: Toomas Soome Date: Mon, 13 Jan 2020 20:02:27 +0000 Subject: [PATCH] Backout 356693. The libsa malloc does provide necessary alignment and memalign by 4 will reduce alignment for some platforms. Thanks for Ian for pointing this out. --- stand/efi/libefi/efinet.c | 2 +- stand/i386/libi386/pxe.c | 2 +- stand/libofw/ofw_net.c | 2 +- stand/uboot/lib/net.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/stand/efi/libefi/efinet.c b/stand/efi/libefi/efinet.c index 989b2efdaac..418790524e4 100644 --- a/stand/efi/libefi/efinet.c +++ b/stand/efi/libefi/efinet.c @@ -178,7 +178,7 @@ efinet_get(struct iodesc *desc, void **pkt, time_t timeout) return (ret); bufsz = net->Mode->MaxPacketSize + ETHER_HDR_LEN + ETHER_CRC_LEN; - buf = memalign(4, bufsz + ETHER_ALIGN); + buf = malloc(bufsz + ETHER_ALIGN); if (buf == NULL) return (ret); ptr = buf + ETHER_ALIGN; diff --git a/stand/i386/libi386/pxe.c b/stand/i386/libi386/pxe.c index 7812e627d7b..217692b515f 100644 --- a/stand/i386/libi386/pxe.c +++ b/stand/i386/libi386/pxe.c @@ -484,7 +484,7 @@ pxe_netif_receive(void **pkt) } size = isr->FrameLength; - buf = memalign(4, size + ETHER_ALIGN); + buf = malloc(size + ETHER_ALIGN); if (buf == NULL) { bio_free(isr, sizeof(*isr)); return (-1); diff --git a/stand/libofw/ofw_net.c b/stand/libofw/ofw_net.c index a037c3defaf..14494ecc2b2 100644 --- a/stand/libofw/ofw_net.c +++ b/stand/libofw/ofw_net.c @@ -142,7 +142,7 @@ ofwn_get(struct iodesc *desc, void **pkt, time_t timeout) * a small shortcut here. */ len = ETHER_MAX_LEN; - buf = memalign(4, len + ETHER_ALIGN); + buf = malloc(len + ETHER_ALIGN); if (buf == NULL) return (-1); ptr = buf + ETHER_ALIGN; diff --git a/stand/uboot/lib/net.c b/stand/uboot/lib/net.c index 852faa794ca..2e1b9ab4caa 100644 --- a/stand/uboot/lib/net.c +++ b/stand/uboot/lib/net.c @@ -302,7 +302,7 @@ net_get(struct iodesc *desc, void **pkt, time_t timeout) #endif if (rlen > 0) { - buf = memalign(4, rlen + ETHER_ALIGN); + buf = malloc(rlen + ETHER_ALIGN); if (buf == NULL) return (-1); memcpy(buf + ETHER_ALIGN, sc->sc_rxbuf, rlen);