Skip to content

Fix kernel warning audit issues#46

Merged
pradosh-arduino merged 1 commit into
mainfrom
codex/fix-bugs-in-frostwing-os-codebase
Jun 28, 2026
Merged

Fix kernel warning audit issues#46
pradosh-arduino merged 1 commit into
mainfrom
codex/fix-bugs-in-frostwing-os-codebase

Conversation

@pradosh-arduino

Copy link
Copy Markdown
Collaborator

Motivation

  • The project switched from permissive warnings to -Wall/pedantic builds which exposed many real bugs and dangerous casts across kernel subsystems.
  • The change set aims to aggressively address high-confidence warning-identified defects while preserving existing kernel architecture and public APIs.
  • Fixes focus on I/O helpers, interrupt setup, device probing, input handling, ELF/FWDE loading, and several API/signature mismatches that could cause undefined behavior.

Description

  • ACPI: corrected OnesOp handling to use UINT64_MAX, constrained SLP type bitshifts, added explicit I/O port casts, and fixed PM1 status wait precedence to (inw(...) & 1U) == 0U. (source/kernel/C/acpi-shutdown.c)
  • PS/2 mouse & keyboard: made internal helpers static, replaced non-standard binary literals with portable masks, stored packets as uint8_t, fixed signed/unsigned movement math and framebuffer clamping, and synced PIT tick types with consumers. (source/kernel/C/user-input/ps2-mouse.c, source/kernel/C/user-input/keyboard.c, source/kernel/C/pit.c)
  • PCI / PCI-ID: removed dangling stack-returned strings by using static buffers and cstring returns, fixed AHCI BAR masking and pointer casts, widened GPU name storage and deferred GPU-global pointer assignment until stable storage exists. (source/kernel/C/pci_id.c, source/kernel/C/pci.c, source/includes/pci.h, source/includes/pci_id.h)
  • ELF / FWDE / IDT: hardened ELF handling for additional FS enums and zero-initialized headers, expanded FWDE signature field and made verify_signature const-correct, fixed IDT pointer initialization and narrowed offset writes before lidt. (source/kernel/C/executables/elf.c, source/includes/executables/fwde.h, source/kernel/C/executables/fwde.c, source/kernel/C/interrupts/idt.c)
  • Miscellaneous API and correctness fixes: made print_bitmap accept const bool*, fixed strlen/string prototypes and itoa visibility, tightened RTC I/O casts and BCD conversions, adjusted logging/ISR prototypes and added missing prototypes for MSR helpers, and cleaned up unused/implicit prototypes across many headers. (multiple source/includes/* and source/kernel/C/* files)

Testing

  • Ran the default build with cd source && make which completed and linked wing_kernel.elf successfully (build artifacts present and linker step finished). (Succeeded)
  • Ran a strict warning-as-error build using the full audit CFLAGS (-Wall -Wextra -Wpedantic -Wshadow -Wconversion -Wsign-conversion -Wcast-align -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wwrite-strings -Wundef -Wformat=2 -Wswitch-enum -Werror ...) which still fails due to remaining FAT16/filesystem-related strict warnings; those areas were left for targeted manual review. (Failed — remaining issues in fat16.c and a few other modules)

Codex Task

@pradosh-arduino pradosh-arduino merged commit 5ebed6d into main Jun 28, 2026
2 checks passed
@pradosh-arduino pradosh-arduino deleted the codex/fix-bugs-in-frostwing-os-codebase branch June 28, 2026 10:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant