Bug 283272 - Use NULL instead of zero for pointers
Summary: Use NULL instead of zero for pointers
Status: Closed Overcome By Events
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 15.0-CURRENT
Hardware: Any Any
: --- Affects Only Me
Assignee: Bugmeister
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-12-11 21:23 UTC by Pedro F. Giffuni
Modified: 2026-07-08 02:45 UTC (History)
3 users (show)

See Also:


Attachments
patch for sys (33.36 KB, patch)
2024-12-11 21:23 UTC, Pedro F. Giffuni
no flags Details | Diff
update diff (git) (33.26 KB, patch)
2024-12-14 01:24 UTC, Pedro F. Giffuni
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Pedro F. Giffuni freebsd_committer freebsd_triage 2024-12-11 21:23:54 UTC
Created attachment 255791 [details]
patch for sys

I ran an old semantic patch with coccinelle and came up with some places that should be using NULL instead of 0 to improve readability.

This was tested by building Universe (only ARM v7 appears broken due to an unrelated issue, also seen in Jenkins).
Comment 1 Pedro F. Giffuni freebsd_committer freebsd_triage 2024-12-11 21:25:22 UTC
(I am not a committer anymore so assign to someone that might be interested).
Comment 2 Brooks Davis freebsd_committer freebsd_triage 2024-12-13 20:23:56 UTC
At a glance, a bunch of these are in contrib or drivers we don't maintain and shouldn't be done locally. For stuff we own (including sys/contrib/libnv) we this seems good.
Comment 3 Ed Maste freebsd_committer freebsd_triage 2024-12-13 21:34:37 UTC
Would you kindly attach a git format patch that can be applied directly (so that it will preserve author metadata).

Also if you don't mind it would be useful to attach the coccinelle file. I think it would be good to have as an example.
Comment 4 Pedro F. Giffuni freebsd_committer freebsd_triage 2024-12-14 00:18:44 UTC
The semantic patch is here:
https://people.freebsd.org/~pfg/patches/cocci/bad_zero.cocci

I keep that directory for reference.
Comment 5 Pedro F. Giffuni freebsd_committer freebsd_triage 2024-12-14 01:24:52 UTC
Created attachment 255848 [details]
update diff (git)
Comment 6 Mark Linimon freebsd_committer freebsd_triage 2026-07-08 02:45:51 UTC
^Triage: unfortunately, this patch no longer applies.

This is a common problem with tree-wide patches; the src tree simply changes
too fast for any reasonable kind of sweep to be useful.

I'm going to take it on myself to close this as OBE, not because I'm judging
whether it's a good or bad idea, but because of simple practicality.