]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
fix warning with gcc 12.2.0 (compiler bug?)
authorArne Schwabe <arne@rfc2549.org>
Sun, 27 Nov 2022 08:59:33 +0000 (09:59 +0100)
committerGert Doering <gert@greenie.muc.de>
Wed, 5 Jul 2023 13:59:10 +0000 (15:59 +0200)
Changing the argument of check_malloc_return from const void* to void*
removes the warning from gcc 12.2.0:

In file included from ../../../openvpn-git/src/openvpn/crypto_openssl.c:40:
../../../openvpn-git/src/openvpn/buffer.h: In function ‘hmac_ctx_new’:
../../../openvpn-git/src/openvpn/buffer.h:1030:9: warning: ‘ctx’ may be
used uninitialized [-Wmaybe-uninitialized]
 1030 |         check_malloc_return((dptr) = (type *)
malloc(sizeof(type))); \
      |         ^~~~~~~~~~~~~~~~~~~
../../../openvpn-git/src/openvpn/buffer.h:1076:1: note: by argument 1 of
type ‘const void *’ to ‘check_malloc_return’ declared here
 1076 | check_malloc_return(const void *p)
      | ^~~~~~~~~~~~~~~~~~~

This more a quick fix/heads up for other people encountering the issue
on GCC 12.2.0 like on Ubuntu 22.10 until we figure out if this is a bug in
our code or a compiler bug.

Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Heiko Hund <heiko@ist.eigentlich.net>
Message-Id: <20221127085933.3487177-1-arne@rfc2549.org>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg25549.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
src/openvpn/buffer.h

index 2461a20703aafa2a764ce40a5ef8460303446cd9..4cc79507e10684b9355788958dd4dd4d32e3e3e7 100644 (file)
@@ -1086,7 +1086,7 @@ gc_reset(struct gc_arena *a)
     }
 
 static inline void
-check_malloc_return(const void *p)
+check_malloc_return(void *p)
 {
     if (!p)
     {