Wed Aug 22 14:11:26 2018 UTC ()
- since we include asan.h unconditionally now, make sure opt_kasan.h is
  included here, following the practice from other header files.
- don't use inline functions, adds complexity (and broke the build)


(christos)
diff -r1.6 -r1.7 src/sys/sys/asan.h

cvs diff -r1.6 -r1.7 src/sys/sys/asan.h (expand / switch to unified diff)

--- src/sys/sys/asan.h 2018/08/22 12:42:06 1.6
+++ src/sys/sys/asan.h 2018/08/22 14:11:26 1.7
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: asan.h,v 1.6 2018/08/22 12:42:06 maxv Exp $ */ 1/* $NetBSD: asan.h,v 1.7 2018/08/22 14:11:26 christos Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2018 The NetBSD Foundation, Inc. 4 * Copyright (c) 2018 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Maxime Villard. 8 * by Maxime Villard.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -22,41 +22,30 @@ @@ -22,41 +22,30 @@
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE. 29 * POSSIBILITY OF SUCH DAMAGE.
30 */ 30 */
31 31
32#ifndef _SYS_ASAN_H_ 32#ifndef _SYS_ASAN_H_
33#define _SYS_ASAN_H_ 33#define _SYS_ASAN_H_
34 34
 35#ifdef _KERNEL_OPT
 36#include "opt_kasan.h"
 37#endif
 38
35#include <sys/types.h> 39#include <sys/types.h>
36 40
37#ifdef KASAN 41#ifdef KASAN
38void kasan_add_redzone(size_t *); 42void kasan_add_redzone(size_t *);
39void kasan_alloc(const void *, size_t, size_t); 43void kasan_alloc(const void *, size_t, size_t);
40void kasan_free(const void *, size_t); 44void kasan_free(const void *, size_t);
41#else 45#else
42__inline static void __unused 46#define kasan_add_redzone(s) __nothing
43kasan_add_redzone(size_t *size __unused) 47#define kasan_alloc(p, s, l) __nothing
44{ 48#define kasan_free(p, s) __nothing
45 /* nothing */ 
46} 
47 
48__inline static void __unused 
49kasan_alloc(const void *addr __unused, size_t size __unused, 
50 size_t sz_with_redz __unused) 
51{ 
52 /* nothing */ 
53} 
54 
55__inline static void __unused 
56kasan_free(const void *addr __unused, size_t sz_with_redz __unused) 
57{ 
58 /* nothing */ 
59} 
60#endif 49#endif
61 50
62#endif /* !_SYS_ASAN_H_ */ 51#endif /* !_SYS_ASAN_H_ */