]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUILD: stream: fix build warning with older compilers
authorWilly Tarreau <w@1wt.eu>
Thu, 24 Feb 2022 18:35:05 +0000 (19:35 +0100)
committerWilly Tarreau <w@1wt.eu>
Thu, 24 Feb 2022 18:43:15 +0000 (19:43 +0100)
GCC 6 was not very good at value propagation and is often mislead about
risks of null derefs. Since 2.6-dev commit 13a35e575 ("MAJOR: conn_stream/
stream-int: move the appctx to the conn-stream"), it sees a risk of null-
deref in stream_upgrade_from_cs() after checking cs_conn_mux(cs). Let's
disguise the result so that it doesn't complain anymore. The output code
is exactly the same. The same method could be used to shut warnings at
-O1 that affect the same compiler by the way.

src/stream.c

index 37cd79378ffb1d8daa6a69929d246fe41627367f..23d431233e4cade52d941280add4f8d218bf5f7d 100644 (file)
@@ -278,7 +278,7 @@ int stream_upgrade_from_cs(struct conn_stream *cs, struct buffer *input)
        struct stream *s = cs_strm(cs);
 
        if (cs_conn_mux(cs)) {
-               const struct mux_ops *mux = cs_conn_mux(cs);
+               const struct mux_ops *mux = DISGUISE(cs_conn_mux(cs));
 
                if (mux->flags & MX_FL_HTX)
                        s->flags |= SF_HTX;