Skip to content

Does open-code-review support BSP / low-level C code review? #1243

Description

@KazusaKitakawa

Problem Statement

Hi, I'm working on a BSP codebase (kernel drivers, device drivers, HAL in C/C++) and wondering if
open-code-review is a good fit for this use case.

A few quick questions:

  1. Are there any built-in rules targeting kernel/driver-specific issues (e.g. spinlock misuse,
    interrupt safety, iomem access)?
  2. Are .dts, .S (assembly), .ld (linker scripts) on the roadmap for the allowlist?
  3. Any plans for a dedicated kernel.md / bsp.md system rule?

Happy to contribute if there's interest. Thanks!

Proposed Solution

same.

Alternatives Considered

No response

Affected Area

Review Agent / LLM interaction

Additional Context

No response

Activity

  1. wu21-web commented on Sep 14, 2026

    @wu21-web
    Contributor

    Please mention this as a sub-issue in #470

  2. basil-k-aji-dev commented on Sep 14, 2026

    @basil-k-aji-dev
    Contributor

    Not a maintainer, but I dug through the source to answer this factually rather than guess.

    Will it review your files at all? Yes.

    The extension allowlist (internal/config/allowlist/supported_file_types.json, 111 entries) includes .c, .h, .cpp, .cc, .cxx, .hpp and .hxx. So ordinary BSP sources go through.

    Worth knowing what is not there, since a BSP tree is usually full of them: .s/.S (assembly), .dts/.dtsi (device tree), .ld (linker scripts), .mk/Kbuild/Kconfig. Those get dropped with ExcludeExtension at internal/scan/agent.go:513. You can admit them anyway with an explicit include glob, which is checked before the allowlist — see the comment at internal/scan/agent.go:507 and #371. In .opencodereview/rule.json:

    { "include": ["**/*.{c,h,S,dts,dtsi}"] }

    Are there kernel/driver-specific rules? No.

    There are 52 per-language rule docs in internal/config/rules/rule_docs/, including c.md and cpp.md, but they are general-purpose C. c.md covers things like malloc/free pairing, double-free, NULLing after free, and typos in declarations. Useful in a driver, but it is ordinary userspace-C advice.

    Nothing targets what actually bites in BSP work: ISR context rules, sleeping in atomic context, DMA coherency and cache maintenance, MMIO ordering and barriers, endianness on register access, copy_from_user validation, IRQ-safe locking, or device-tree binding correctness. There is a vhdl.md, so hardware-adjacent languages are not off-limits in principle — there is just no kernel rule set today.

    What I would do in your position

    Project rules are the supported way to add domain knowledge — .opencodereview/rule.json with merge_system_rule so your BSP rules sit alongside the built-in C ones rather than replacing them (that flag is documented in #1133). A short rule file covering your driver conventions will likely outperform the generic C rules for this codebase.

    Take the "no kernel rules" part as a reading of the tree at today's main, not an official answer — a maintainer may have plans I cannot see from the source.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions