From: Yu Watanabe Date: Thu, 24 Nov 2022 17:56:42 +0000 (+0900) Subject: sd-netlink: allocate read buffer when necessary X-Git-Tag: v253-rc1~431^2~10 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=fb298ef10440053fa9a6a72a43d67f04ae14c72f;p=thirdparty%2Fsystemd.git sd-netlink: allocate read buffer when necessary --- diff --git a/src/libsystemd/sd-netlink/netlink-socket.c b/src/libsystemd/sd-netlink/netlink-socket.c index 103a23270e2..55dc51ab502 100644 --- a/src/libsystemd/sd-netlink/netlink-socket.c +++ b/src/libsystemd/sd-netlink/netlink-socket.c @@ -255,7 +255,6 @@ int socket_read_message(sd_netlink *nl) { int r; assert(nl); - assert(nl->rbuffer); /* read nothing, just get the pending message size */ r = socket_recv_message(nl->fd, NULL, 0, NULL, true); diff --git a/src/libsystemd/sd-netlink/sd-netlink.c b/src/libsystemd/sd-netlink/sd-netlink.c index b99abae6400..1202fe10a55 100644 --- a/src/libsystemd/sd-netlink/sd-netlink.c +++ b/src/libsystemd/sd-netlink/sd-netlink.c @@ -61,10 +61,6 @@ static int netlink_new(sd_netlink **ret) { .serial = (uint32_t) (now(CLOCK_MONOTONIC) % UINT32_MAX) + 1, }; - /* We guarantee that the read buffer has at least space for a message header */ - if (!greedy_realloc((void**) &nl->rbuffer, sizeof(struct nlmsghdr), sizeof(uint8_t))) - return -ENOMEM; - *ret = TAKE_PTR(nl); return 0; }