git: b7f7cc25c01a - main - libcasper: Neuter false positive -Wuse-after-free warnings from GCC 13
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 15 Nov 2023 02:37:40 UTC
The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=b7f7cc25c01aeacaafb86ebcffdeb258b7933b08 commit b7f7cc25c01aeacaafb86ebcffdeb258b7933b08 Author: John Baldwin <jhb@FreeBSD.org> AuthorDate: 2023-11-15 02:34:01 +0000 Commit: John Baldwin <jhb@FreeBSD.org> CommitDate: 2023-11-15 02:34:01 +0000 libcasper: Neuter false positive -Wuse-after-free warnings from GCC 13 GCC 13 incorrectly thinks a call to free after a failed realloc is a use after free. lib/libcasper/services/cap_grp/cap_grp.c: In function 'group_resize': lib/libcasper/services/cap_grp/cap_grp.c:65:17: error: pointer 'buf' may be used after 'realloc' [-Werror=use-after-free] 65 | free(buf); | ^~~~~~~~~ lib/libcasper/services/cap_grp/cap_grp.c:63:19: note: call to 'realloc' here 63 | gbuffer = realloc(buf, gbufsize); | ^~~~~~~~~~~~~~~~~~~~~~ Reviewed by: imp, emaste Differential Revision: https://reviews.freebsd.org/D42576 --- lib/libcasper/services/cap_grp/Makefile | 3 +++ lib/libcasper/services/cap_netdb/Makefile | 3 +++ lib/libcasper/services/cap_pwd/Makefile | 3 +++ 3 files changed, 9 insertions(+) diff --git a/lib/libcasper/services/cap_grp/Makefile b/lib/libcasper/services/cap_grp/Makefile index b46f3bfdaa47..0f722e3979f9 100644 --- a/lib/libcasper/services/cap_grp/Makefile +++ b/lib/libcasper/services/cap_grp/Makefile @@ -40,3 +40,6 @@ MLINKS+=cap_grp.3 cap_grp_limit_fields.3 MLINKS+=cap_grp.3 cap_grp_limit_groups.3 .include <bsd.lib.mk> + +# GCC 13 complains incorrectly about free after failed realloc: GCC bug #110501 +CFLAGS.cap_grp.c+= ${NO_WUSE_AFTER_FREE} diff --git a/lib/libcasper/services/cap_netdb/Makefile b/lib/libcasper/services/cap_netdb/Makefile index 36c57103b414..653aa21c9b32 100644 --- a/lib/libcasper/services/cap_netdb/Makefile +++ b/lib/libcasper/services/cap_netdb/Makefile @@ -29,3 +29,6 @@ MLINKS+=cap_netdb.3 libcap_netdb.3 MLINKS+=cap_netdb.3 cap_getprotobyname.3 .include <bsd.lib.mk> + +# GCC 13 complains incorrectly about free after failed realloc: GCC bug #110501 +CFLAGS.cap_netdb.c+= ${NO_WUSE_AFTER_FREE} diff --git a/lib/libcasper/services/cap_pwd/Makefile b/lib/libcasper/services/cap_pwd/Makefile index be6b4b21070f..4e0e6db6f86d 100644 --- a/lib/libcasper/services/cap_pwd/Makefile +++ b/lib/libcasper/services/cap_pwd/Makefile @@ -40,3 +40,6 @@ MLINKS+=cap_pwd.3 cap_pwd_limit_fields.3 MLINKS+=cap_pwd.3 cap_pwd_limit_users.3 .include <bsd.lib.mk> + +# GCC 13 complains incorrectly about free after failed realloc: GCC bug #110501 +CFLAGS.cap_pwd.c+= ${NO_WUSE_AFTER_FREE}