-
Notifications
You must be signed in to change notification settings - Fork 3.4k
contrib/cocci: add hexdump() and hexdump.h include coccinelle rules #40930
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd add a check to ignore all bpf/tests
files, and the hexdump.h
library itself.
In all the other cases, the cocci script must point out the error (and fail PRs).
See the comment I've left.
e09b101
to
8208cdc
Compare
cc @qmonnet |
8208cdc
to
35adb9a
Compare
Failure coccicheck output with the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🚀
Left a couple of thoughts, but nothing to compromise the PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't played with 🐞 in a while, and I don't remember enough of the semantics to provide meaningful feedback. But from far above, this looks good, thanks for adding this!
3746b32
to
c819486
Compare
Asking for a rereview, @smagnani96 since I cleaned them up quite a bit. A singing CI run: https://github.com/cilium/cilium/actions/runs/16781233206/job/47520160835?pr=40930 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Scripts look amazing, would simply merge them in 1.
See review comment.
abadf4a
to
c86d460
Compare
Add coccinelle rule that checks for the usage of hexdump*() functions, HEXDUMP*() MACROs and the inclusion of `hexdump.h`. Given that these use printk(), they should be avoided on any production code (so all code other than `hexdump.h` itself and tests/). Fixes cilium#40929 Signed-off-by: Marc Suñé <marc.sune@isovalent.com> Signed-off-by: Simone Magnani <simone.magnani@isovalent.com>
c86d460
to
c99c67d
Compare
Can we merge? |
/test (hoped it was smart enough to skip) |
Add two new coccinelle rules that check:
hexdump*()
andHEXDUMP*()
family of functions and MACROs.hexdump.h
in BPF production code.
Fixes #40929