[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 07/17] kern/rdxtree: Fix undefined behavior
From: |
Sergey Bugaev |
Subject: |
[PATCH 07/17] kern/rdxtree: Fix undefined behavior |
Date: |
Wed, 27 Mar 2024 19:18:31 +0300 |
Initializing a variable with itself is undefined, and GCC 14 rightfully
produces a warning about the variable being used (to initialize itself)
prior to initialization. X15 sets the variables to 0 instead, so do the
same in Mach.
---
kern/rdxtree.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/kern/rdxtree.c b/kern/rdxtree.c
index a23d6e7e..6d03710c 100644
--- a/kern/rdxtree.c
+++ b/kern/rdxtree.c
@@ -437,7 +437,7 @@ rdxtree_insert_common(struct rdxtree *tree, rdxtree_key_t
key,
void *ptr, void ***slotp)
{
struct rdxtree_node *node, *prev;
- unsigned int height, shift, index = index;
+ unsigned int height, shift, index = 0;
int error;
assert(ptr != NULL);
@@ -513,7 +513,7 @@ rdxtree_insert_alloc_common(struct rdxtree *tree, void *ptr,
rdxtree_key_t *keyp, void ***slotp)
{
struct rdxtree_node *node, *prev;
- unsigned int height, shift, index = index;
+ unsigned int height, shift, index = 0;
rdxtree_key_t key;
int error;
--
2.44.0
- [PATCH 08/17] ipc: Turn ipc_entry_lookup_failed() into a macro, (continued)
- [PATCH 08/17] ipc: Turn ipc_entry_lookup_failed() into a macro, Sergey Bugaev, 2024/03/27
- [PATCH 11/17] tests: Fix halt(), Sergey Bugaev, 2024/03/27
- [PATCH 09/17] Move copy{in,out}msg declarations to copy_user.h, Sergey Bugaev, 2024/03/27
- [PATCH 15/17] tests: Make exception subcode a long, Sergey Bugaev, 2024/03/27
- [PATCH 12/17] tests: Add a more serious mach_msg_server() routine, Sergey Bugaev, 2024/03/27
- [PATCH 07/17] kern/rdxtree: Fix undefined behavior,
Sergey Bugaev <=
- [PATCH 17/17] tests: Create tests/ in the build tree before trying to use it, Sergey Bugaev, 2024/03/27
- [PATCH 16/17] tests: Don't ask for executable stack, Sergey Bugaev, 2024/03/27
- [PATCH 10/17] Make -fno-PIE etc. architecture-dependent, Sergey Bugaev, 2024/03/27
- [PATCH 13/17] tests: Add vm_page_size, Sergey Bugaev, 2024/03/27
- [PATCH 14/17] tests: Use vm_page_size, Sergey Bugaev, 2024/03/27