aboutgitcodebugslistschat
path: root/tcp_splice.c
diff options
context:
space:
mode:
authorStefano Brivio <sbrivio@redhat.com>2022-11-19 09:29:54 +0100
committerStefano Brivio <sbrivio@redhat.com>2022-11-25 01:37:36 +0100
commitb06014a6b2f35bb3ca58e94a6ef84e3644e49fb0 (patch)
tree658deedb11e2f17417339ec16ad4f577d2338286 /tcp_splice.c
parent8e914238b6def7abc61d97482dd618cfc3a061bd (diff)
downloadpasst-b06014a6b2f35bb3ca58e94a6ef84e3644e49fb0.tar
passt-b06014a6b2f35bb3ca58e94a6ef84e3644e49fb0.tar.gz
passt-b06014a6b2f35bb3ca58e94a6ef84e3644e49fb0.tar.bz2
passt-b06014a6b2f35bb3ca58e94a6ef84e3644e49fb0.tar.lz
passt-b06014a6b2f35bb3ca58e94a6ef84e3644e49fb0.tar.xz
passt-b06014a6b2f35bb3ca58e94a6ef84e3644e49fb0.tar.zst
passt-b06014a6b2f35bb3ca58e94a6ef84e3644e49fb0.zip
tcp: Pass union tcp_conn pointer to destroy and splice timer functions
The pointers are actually the same, but we later pass the container union to tcp_table_compact(), which might zero the size of the whole union, and this confuses Coverity Scan. Given that we have pointers to the container union to start with, just pass those instead, all the way down to tcp_table_compact(). Signed-off-by: Stefano Brivio <sbrivio@redhat.com> Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'tcp_splice.c')
-rw-r--r--tcp_splice.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/tcp_splice.c b/tcp_splice.c
index e2f0ce1..72b1672 100644
--- a/tcp_splice.c
+++ b/tcp_splice.c
@@ -251,10 +251,12 @@ void tcp_splice_conn_update(struct ctx *c, struct tcp_splice_conn *new)
/**
* tcp_splice_destroy() - Close spliced connection and pipes, clear
* @c: Execution context
- * @conn: Connection pointer
+ * @conn_union: Spliced connection (container union)
*/
-void tcp_splice_destroy(struct ctx *c, struct tcp_splice_conn *conn)
+void tcp_splice_destroy(struct ctx *c, union tcp_conn *conn_union)
{
+ struct tcp_splice_conn *conn = &conn_union->splice;
+
if (conn->events & SPLICE_ESTABLISHED) {
/* Flushing might need to block: don't recycle them. */
if (conn->pipe_a_b[0] != -1) {
@@ -283,7 +285,7 @@ void tcp_splice_destroy(struct ctx *c, struct tcp_splice_conn *conn)
debug("TCP (spliced): index %li, CLOSED", CONN_IDX(conn));
c->tcp.splice_conn_count--;
- tcp_table_compact(c, (union tcp_conn *)conn);
+ tcp_table_compact(c, conn_union);
}
/**
@@ -824,12 +826,14 @@ void tcp_splice_init(struct ctx *c)
/**
* tcp_splice_timer() - Timer for spliced connections
* @c: Execution context
- * @conn: Spliced connection
+ * @conn_union: Spliced connection (container union)
*/
-void tcp_splice_timer(struct ctx *c, struct tcp_splice_conn *conn)
+void tcp_splice_timer(struct ctx *c, union tcp_conn *conn_union)
{
+ struct tcp_splice_conn *conn = &conn_union->splice;
+
if (conn->flags & CLOSING) {
- tcp_splice_destroy(c, conn);
+ tcp_splice_destroy(c, conn_union);
return;
}