netlink_snl: error flag in wrong place?
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 02 Oct 2025 17:50:15 UTC
Hi, in snl_init_writer() function the error flag is always set to false.
I think the flag should be set at the beginning so that in case of
failure the error is reported.
--- netlink_snl_old.h 2025-10-02 14:17:36.369302000 -0300
+++ netlink_snl.h 2025-10-02 14:17:56.411429000 -0300
@@ -1021,20 +1021,20 @@
};
static inline void
snl_init_writer(struct snl_state *ss, struct snl_writer *nw)
{
+ nw->error = false;
nw->size = SNL_WRITER_BUFFER_SIZE;
nw->base = (char *)snl_allocz(ss, nw->size);
if (nw->base == NULL) {
nw->error = true;
nw->size = 0;
}
nw->offset = 0;
nw->hdr = NULL;
- nw->error = false;
nw->ss = ss;
}
static inline bool
snl_realloc_msg_buffer(struct snl_writer *nw, size_t sz)