Skip to contentSkip to conversation

sanitize: add ifdef guard around sanitizer functions

PATCH In review David Wei 2 participants 2 messages Oct 3, 2024 io_uring

lore
Share & tools
lore

David Wei

author
#0 lore raw

PATCH 1/1 sanitize: add ifdef guard around sanitizer functions

Otherwise there are redefinition errors during compilation if CONFIG_USE_SANITIZER isn't set.

---
 src/sanitize.c | 2 ++
 1 file changed, 2 insertions(+)
src/sanitize.c +2 -0
index 46391a6..db5930d 100644
@@ -118,6 +118,7 @@ static inline void initialize_sanitize_handlers()
 	sanitize_handlers_initialized = true;
 }
 
+#if defined(CONFIG_USE_SANITIZER)
 void liburing_sanitize_ring(struct io_uring *ring)
 {
 	struct io_uring_sq *sq = &ring->sq;
@@ -174,3 +175,4 @@ void liburing_sanitize_iovecs(const struct iovec *iovecs, unsigned nr)
 		}
 	}
 }
+#endif
Signature · 1 line
2.43.5
maintainer
#1 lore raw
Quoted 21 lines · David Wei

Otherwise there are redefinition errors during compilation if CONFIG_USE_SANITIZER isn't set.

---
 src/sanitize.c | 2 ++
 1 file changed, 2 insertions(+)
src/sanitize.c +1 -0
index 46391a6..db5930d 100644
@@ -118,6 +118,7 @@ static inline void initialize_sanitize_handlers()
 	sanitize_handlers_initialized = true;
 }
 
+#if defined(CONFIG_USE_SANITIZER)
 void liburing_sanitize_ring(struct io_uring *ring)
 {
 	struct io_uring_sq *sq = &ring->sq;

src/sanitize.c void liburing_sanitize_iovecs(const struct iovec *iovecs, unsigned nr) · line 178

Quoted 4 lines
src/sanitize.c +1 -0
@@ -174,3 +175,4 @@ void liburing_sanitize_iovecs(const struct iovec *iovecs, unsigned nr)
 		}
 	}
 }
+#endif

Hmm, but src/sanitize.o should not be built unless that is set. How is this happening?

Signature · 1 line
Jens Axboe