arch/posix: make posix_fuzz_buf const

The original buffer is const as well and we're not allowed to modify it.

Signed-off-by: Michael Zimmermann <sigmaepsilon92@gmail.com>
diff --git a/boards/posix/native_posix/main.c b/boards/posix/native_posix/main.c
index 86c7937..c905305 100644
--- a/boards/posix/native_posix/main.c
+++ b/boards/posix/native_posix/main.c
@@ -127,7 +127,7 @@
  * "long enough" to handle the event and reach a quiescent state
  * again)
  */
-uint8_t *posix_fuzz_buf;
+const uint8_t *posix_fuzz_buf;
 size_t posix_fuzz_sz;
 
 int LLVMFuzzerTestOneInput(const uint8_t *data, size_t sz)
@@ -142,7 +142,7 @@
 	/* Provide the fuzz data to Zephyr as an interrupt, with
 	 * "DMA-like" data placed into posix_fuzz_buf/sz
 	 */
-	posix_fuzz_buf = (void *)data;
+	posix_fuzz_buf = data;
 	posix_fuzz_sz = sz;
 	hw_irq_ctrl_set_irq(CONFIG_ARCH_POSIX_FUZZ_IRQ);
 
diff --git a/samples/subsys/debug/fuzz/src/main.c b/samples/subsys/debug/fuzz/src/main.c
index 3937e87..ae486e9 100644
--- a/samples/subsys/debug/fuzz/src/main.c
+++ b/samples/subsys/debug/fuzz/src/main.c
@@ -23,21 +23,21 @@
 
 #define LASTKEY (ARRAY_SIZE(key) - 1)
 
-#define GEN_CHECK(cur, nxt)						\
-	void check##nxt(uint8_t *data, size_t sz);			\
-	void __attribute__((noinline)) check##cur(uint8_t *data, size_t sz) \
-	{								\
-		if (cur < sz && data[cur] == key[cur]) {		\
-			if (!found[cur]) {				\
-				printk("#\n# Found key %d\n#\n", cur);	\
-				found[cur] = true;			\
-			}						\
-			if (cur == LASTKEY) {				\
-				*global_null_ptr = 0; /* boom! */	\
-			} else {					\
-				check##nxt(data, sz);			\
-			}						\
-		}							\
+#define GEN_CHECK(cur, nxt)                                                                        \
+	void check##nxt(const uint8_t *data, size_t sz);                                           \
+	void __attribute__((noinline)) check##cur(const uint8_t *data, size_t sz)                  \
+	{                                                                                          \
+		if (cur < sz && data[cur] == key[cur]) {                                           \
+			if (!found[cur]) {                                                         \
+				printk("#\n# Found key %d\n#\n", cur);                             \
+				found[cur] = true;                                                 \
+			}                                                                          \
+			if (cur == LASTKEY) {                                                      \
+				*global_null_ptr = 0; /* boom! */                                  \
+			} else {                                                                   \
+				check##nxt(data, sz);                                              \
+			}                                                                          \
+		}                                                                                  \
 	}
 
 GEN_CHECK(0, 1)
@@ -49,7 +49,7 @@
 GEN_CHECK(6, 0)
 
 /* Fuzz input received from LLVM via "interrupt" */
-extern uint8_t *posix_fuzz_buf;
+extern const uint8_t *posix_fuzz_buf;
 extern size_t posix_fuzz_sz;
 
 K_SEM_DEFINE(fuzz_sem, 0, K_SEM_MAX_LIMIT);