Fix kernel warnings and memory-safety issues#45
Merged
pradosh-arduino merged 1 commit intoJun 28, 2026
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
-Wstrict-prototypesand related pedantic checks.Description
static ahci_port_mem_t port_mem[32];toexterninincludes/ahci.hand defineahci_port_mem_t port_mem[32];once inkernel/C/ahci.cto avoid duplicate definitions and unused-variable warnings.NULL, only copying from DMA buffers on successful operations, and guarding frees inahci.c/nvme.c/gpt.c/mbr.cto avoid uninitialized use and double-free/copy-on-failure paths.<string.h>/<memory.h>,strdup,memcpyusages) and convert many no-argument function declarations/definitions to strict prototypes(void)across headers and C files to fix-Wstrict-prototypesand missing-prototype diagnostics.va_argtypes indebugger.c, providing a local 64-bit-to-hex helper, and adding explicit casts/unsigned suffixes where arithmetic could change sign/width (AHCI/NVMe/TSS/GDT/paging/etc.).acpi.cby copying theacpi_gasbefore using it and mark OEM stringconstto avoid discarded-qualifiers.remove_mount,list_all_mounts,io_wait_us/io_wait_ms) and add a non-executable.note.GNU-stacksection to the syscall ASM to silence linker executable-stack warnings.Testing
make -C source) which completes and linkswing_kernel.elfsuccessfully after the changes.CFLAGS/-Wall -Wextra -Wpedantic ... -Werrorand triaged/fixed many issues; the strict build was run repeatedly and the majority of warnings were eliminated but one remaining strict-blocker was observed inkernel/C/image/targa.c(narrowing/prototype issues) and left for a follow-up.git diff --checkand a pre-commit check and committed the changes (commit present) with the working-tree passing themakeinvocation used for CI above.Codex Task