Enable compiler warnings and fix format string security issues#4
Open
assisted-by-ai wants to merge 1 commit intoKicksecure:masterfrom
Open
Enable compiler warnings and fix format string security issues#4assisted-by-ai wants to merge 1 commit intoKicksecure:masterfrom
assisted-by-ai wants to merge 1 commit intoKicksecure:masterfrom
Conversation
ArrayBolt3
reviewed
Apr 7, 2026
module/tirdad.c
Outdated
Comment on lines
+26
to
+32
| void _s_out(u8 err, char *fmt, ...); | ||
| __printf(2, 3) void _s_out(u8 err, const char *fmt, ...); | ||
|
|
||
| int hook_init(void); | ||
| void hook_exit(void); | ||
|
|
||
|
|
||
| void _s_out(u8 err, char *fmt, ...){ | ||
| void _s_out(u8 err, const char *fmt, ...){ |
There was a problem hiding this comment.
This is an exact duplicate of https://github.com/Kicksecure/tirdad/pull/3/changes.
module/Makefile
Outdated
Comment on lines
+2
to
+9
|
|
||
| ccflags-y += -Wall | ||
| ccflags-y += -Wextra | ||
| ccflags-y += -Werror | ||
| ccflags-y += -Wformat | ||
| ccflags-y += -Wformat-security | ||
| ccflags-y += -Wformat-nonliteral | ||
| ccflags-y += -Wno-unused-parameter |
There was a problem hiding this comment.
The Linux kernel already sets appropriate compiler warning flags in its build infrastructure (which AIUI applies to modules as well). We should not be setting our own flags. (Kernel module developers might use make KCFLAGS=-W to enable verbose warnings at development time, according to the kernel's Documentation/process/4.Coding.rst file.)
adrelanos
pushed a commit
that referenced
this pull request
Apr 10, 2026
Add AGENTS.md with project context and upstream PR notes
Add documentation of the rejected compiler warning flags PR (#4) so future agents don't re-propose hardcoding ccflags-y in the module Makefile. Kbuild already handles warning flags for modules. https://claude.ai/code/session_01TGuvnh5mbFAcuVWNxMcuKP
d7474fd to
e1cc04e
Compare
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.
Summary
This PR enhances code quality by enabling strict compiler warnings in the kernel module build and fixes format string security issues in the
_s_out()function.Key Changes
Makefile: Added comprehensive compiler warning flags:
-Wall -Wextra: Enable all common warnings-Werror: Treat warnings as errors to enforce compliance-Wformat -Wformat-security -Wformat-nonliteral: Format string security checks-Wno-unused-parameter: Suppress unused parameter warnings for cleaner outputtirdad.c: Fixed format string security issues:
__printf(2, 3)attribute to_s_out()function declaration for compiler format checkingfmtparameter fromchar *toconst char *in both declaration and definition to properly indicate the format string is not modifiedImplementation Details
The
__printf(2, 3)attribute tells the compiler to validate the format string (2nd parameter) and variadic arguments (starting from 3rd parameter) using printf-style format checking rules. This helps catch format string vulnerabilities and mismatches at compile time. Theconstqualifier on the format string parameter is the correct practice for variadic functions that don't modify the format string.https://claude.ai/code/session_01TGuvnh5mbFAcuVWNxMcuKP