2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 14:25:26 +00:00

jsonrpc: Don't access ovs_list members directly.

The Clang analyzer has trouble tracking the pointer usage in jsonrpc_run
and will report a use after free incorrectly. This patch migrates to
using standard ovs_list functions instead of directly accessing the next
member, which suppresses clang's warning.

Acked-by: Simon Horman <horms@ovn.org>
Signed-off-by: Mike Pattrick <mkp@redhat.com>
Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
This commit is contained in:
Mike Pattrick
2024-09-09 00:55:00 -04:00
committed by Eelco Chaudron
parent a67db28fd9
commit cfb0abb951

View File

@@ -120,7 +120,8 @@ jsonrpc_run(struct jsonrpc *rpc)
stream_run(rpc->stream);
while (!ovs_list_is_empty(&rpc->output)) {
struct ofpbuf *buf = ofpbuf_from_list(rpc->output.next);
struct ovs_list *head = ovs_list_front(&rpc->output);
struct ofpbuf *buf = ofpbuf_from_list(head);
int retval;
retval = stream_send(rpc->stream, buf->data, buf->size);
@@ -128,7 +129,7 @@ jsonrpc_run(struct jsonrpc *rpc)
rpc->backlog -= retval;
ofpbuf_pull(buf, retval);
if (!buf->size) {
ovs_list_remove(&buf->list_node);
ovs_list_remove(head);
rpc->output_count--;
ofpbuf_delete(buf);
}