From e72e16c55df48194c354e82bd31415529c7a92a9 Mon Sep 17 00:00:00 2001 From: Mateusz Guzik Date: Mon, 23 Aug 2021 16:20:53 +0000 Subject: [PATCH] Remove bzero declaration The kernel was migrated to memset in ba96f37758412151 ("Use __builtin for various mem* and b* (e.g. bzero) routines.") and there are no remaining architectures using the file. malloc is augmented to prevent KMSAN from breaking. Sponsored by: Rubicon Communications, LLC ("Netgate") --- sys/sys/malloc.h | 2 +- sys/sys/systm.h | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/sys/sys/malloc.h b/sys/sys/malloc.h index 3d88460a751e..b83d78a18444 100644 --- a/sys/sys/malloc.h +++ b/sys/sys/malloc.h @@ -233,7 +233,7 @@ void *malloc(size_t size, struct malloc_type *type, int flags) __malloc_like _malloc_item = malloc(_size, type, (flags) &~ M_ZERO); \ if (((flags) & M_WAITOK) != 0 || \ __predict_true(_malloc_item != NULL)) \ - bzero(_malloc_item, _size); \ + memset(_malloc_item, 0, _size); \ } else { \ _malloc_item = malloc(_size, type, flags); \ } \ diff --git a/sys/sys/systm.h b/sys/sys/systm.h index 1be8f1ac49be..17d1e8933997 100644 --- a/sys/sys/systm.h +++ b/sys/sys/systm.h @@ -342,7 +342,6 @@ void hexdump(const void *ptr, int length, const char *hdr, int flags); #define ovbcopy(f, t, l) bcopy((f), (t), (l)) void bcopy(const void * _Nonnull from, void * _Nonnull to, size_t len); -void bzero(void * _Nonnull buf, size_t len); void explicit_bzero(void * _Nonnull, size_t); void *memset(void * _Nonnull buf, int c, size_t len);