Skip to content

bsdkm: misc cleanup.#10546

Open
philljj wants to merge 2 commits into
wolfSSL:masterfrom
philljj:malloc_nowait
Open

bsdkm: misc cleanup.#10546
philljj wants to merge 2 commits into
wolfSSL:masterfrom
philljj:malloc_nowait

Conversation

@philljj
Copy link
Copy Markdown
Contributor

@philljj philljj commented May 28, 2026

Description

Some bsdkm cleanup:

  • Use malloc() M_NOWAIT in critical section, and M_WAITOK otherwise..
  • Macro cleanup.
  • Add better err handling cleanup (was not actually leaking on error, but this will make it more clear to analyzers).

Fixes several Fenrir issues.

@philljj philljj self-assigned this May 28, 2026
Copilot AI review requested due to automatic review settings May 28, 2026 04:30
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Minor cleanup of the FreeBSD kernel module (bsdkm) port: make XMALLOC choose its wait flag based on whether the caller is in a critical section, consolidate error/cleanup paths in wolfkmod_load() and wolfkdriv_attach() so failures don't leak resources to analyzers, and tidy up some comments and macros.

Changes:

  • bsdkm_wc_port.h: include <sys/proc.h> and choose M_WAITOK/M_NOWAIT for XMALLOC based on curthread->td_critnest; debug XFREE prints the captured pointer _xp.
  • wolfkmod.c: single wolfkmod_load_out cleanup path for wolfkmod_load(); route wolfkmod_init() and crypto_get_driverid() failures through attach_out, which now also calls wolfkmod_cleanup() on error (and no longer overwrites error with ENXIO).
  • x86_vecreg.c: comment-only clarifications.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
bsdkm/bsdkm_wc_port.h Context-sensitive malloc wait flag; minor debug XFREE print fix.
bsdkm/wolfkmod.c Consolidated error-handling in wolfkmod_load and wolfkdriv_attach.
bsdkm/x86_vecreg.c Comment cleanup for fpu state struct and fpu_states array.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread bsdkm/x86_vecreg.c Outdated
@philljj
Copy link
Copy Markdown
Contributor Author

philljj commented May 28, 2026

Retest this please.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants