]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUILD: ech: fix clang warnings
authorWilliam Lallemand <wlallemand@haproxy.com>
Fri, 14 Nov 2025 10:35:38 +0000 (11:35 +0100)
committerWilliam Lallemand <wlallemand@haproxy.com>
Fri, 14 Nov 2025 10:35:38 +0000 (11:35 +0100)
No impact as the state is either SHOW_ECH_SPECIFIC or SHOW_ECH_ALL but
never anything else.

src/ech.c:240:6: error: variable 'p' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
  240 |         if (ctx->state == SHOW_ECH_ALL) {
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~
src/ech.c:275:12: note: uninitialized use occurs here
  275 |         ctx->pp = p;
      |                   ^
src/ech.c:240:2: note: remove the 'if' if its condition is always true
  240 |         if (ctx->state == SHOW_ECH_ALL) {
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/ech.c:228:17: note: initialize the variable 'p' to silence this warning
  228 |         struct proxy *p;
      |                        ^
      |                         = NULL
src/ech.c:240:6: error: variable 'bind_conf' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
  240 |         if (ctx->state == SHOW_ECH_ALL) {
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~
src/ech.c:276:11: note: uninitialized use occurs here
  276 |         ctx->b = bind_conf;
      |                  ^~~~~~~~~
src/ech.c:240:2: note: remove the 'if' if its condition is always true
  240 |         if (ctx->state == SHOW_ECH_ALL) {
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/ech.c:229:29: note: initialize the variable 'bind_conf' to silence this warning
  229 |         struct bind_conf *bind_conf;
      |                                    ^
      |                                     = NULL
2 errors generated.
make: *** [Makefile:1062: src/ech.o] Error 1

src/ech.c

index 2acd898e124470e514c3f1b8428ecc4cb1f68a03..e448ff781b9d5257be30dd05890ade34adabf826 100644 (file)
--- a/src/ech.c
+++ b/src/ech.c
@@ -225,8 +225,8 @@ static int cli_io_handler_ech_details(struct appctx *appctx)
        struct buffer *trash = get_trash_chunk();
        struct show_ech_ctx *ctx = appctx->svcctx;
        int ret = 0;
-       struct proxy *p;
-       struct bind_conf *bind_conf;
+       struct proxy *p = NULL;
+       struct bind_conf *bind_conf = NULL;
        if (!ctx) return 1;
 
        if (ctx->state == SHOW_ECH_SPECIFIC) {