ReviewOS

home-lang/home-os

Kernel typecheck cleanups omnibus — missing imports, renames, idiom fixes

#18
Closed glennmichael123 opened this 9 days ago ·
9 days ago

Context

The 2026-05-04-pm audit triage flagged ~9 kernel files with genuine kernel bugs (not typechecker gaps). All small per-file fixes; bundling here.

Sub-items

1. Missing imports (2 files)

  • `kernel/src/container/oci.home` — uses `basics.memset(...)` etc. but `basics` never imported. Header comment says it was migrated to `import … as` form but the migration was incomplete.
  • `kernel/src/ui/wallpaper.home` — uses `memory.kmalloc(8294400)` but `memory` not imported (only `foundation`, `filesystem`, `framebuffer`). Add the import.

2. Identifier rename (1 file)

  • `kernel/src/net/tcp.home:532` — uses `connections[conn_idx].remote_ip` but the array is named `tcp_connections` (declared on line 216).

3. Wrong call-shape (1 file)

  • `kernel/src/drivers/gpu.home:198` — `gpu_blit(...)` called with 7 args, but `fn gpu_blit(src_tex: u32, dst_x: i32, dst_y: i32)` only takes 3. Remaining 4 args suggest a `gpu_blit_scaled` API that was never written. Reduce to 3-arg form OR define the wider function.

4. Foreign syntax (1 file)

  • `kernel/src/fs/fat32.home:691` — uses Pascal-style `if X then Y else Z` (2 occurrences). Rewrite to braced form.

5. Bool-as-int idiom (1 file)

  • `kernel/src/security/wx_enforcement.home:69` — `var is_writable: u32 = (prot & PAGE_PROT_WRITE) != 0` assigns bool to u32. Rewrite as `if (prot & PAGE_PROT_WRITE) != 0 { 1 } else { 0 }`.

6. Logical-not on integer (1 file)

  • `kernel/src/container/orchestrator.home:409` — `if !string_equals_64(...)` where `string_equals_64` returns u32. Replace with `== 0`.

7. DMA buffer init (2 files)

  • `kernel/src/rpi/mailbox_vc6.home:287` and `vc7.home:280` — `var buffer: [32]u8` (no init); code passes `&buffer[N]` to external DMA before reading. Add `= [0] ** 32` or `= undefined`.

Reference

  • 2026-05-04-pm audit: `~/Desktop/home-os-kernel-audit-2026-05-04-pm.tsv`

Sign in to comment on this issue.