git: 794299ac6876 - stable/15 - netlink: in snl_init_writer() don't overwrite error in case of failure
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 15 Oct 2025 18:59:26 UTC
The branch stable/15 has been updated by glebius:
URL: https://cgit.FreeBSD.org/src/commit/?id=794299ac6876ecdf62e503d3fb05bd388f5c8be7
commit 794299ac6876ecdf62e503d3fb05bd388f5c8be7
Author: Bruno Silvestre <bruno.silvestre@gmail.com>
AuthorDate: 2025-10-07 05:48:28 +0000
Commit: Gleb Smirnoff <glebius@FreeBSD.org>
CommitDate: 2025-10-15 18:57:46 +0000
netlink: in snl_init_writer() don't overwrite error in case of failure
PR: 290050
(cherry picked from commit 488718ff42346888243496c00cbeb42ba004171e)
---
sys/netlink/netlink_snl.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/sys/netlink/netlink_snl.h b/sys/netlink/netlink_snl.h
index 586716776bc5..ca1169d24b91 100644
--- a/sys/netlink/netlink_snl.h
+++ b/sys/netlink/netlink_snl.h
@@ -1057,14 +1057,14 @@ snl_init_writer(struct snl_state *ss, struct snl_writer *nw)
{
nw->size = SNL_WRITER_BUFFER_SIZE;
nw->base = (char *)snl_allocz(ss, nw->size);
- if (nw->base == NULL) {
+ if (__predict_false(nw->base == NULL)) {
nw->error = true;
nw->size = 0;
- }
+ } else
+ nw->error = false;
nw->offset = 0;
nw->hdr = NULL;
- nw->error = false;
nw->ss = ss;
}