Skip to contentSkip to conversation

Coccicheck - sizeof() min()

Outreachy Info Alison Schofield 1 participant 1 message Mar 22, 2023

lore
Share & tools
lore
#0 lore raw

I took a look at drivers/staging to see what you all may discover when running Coccicheck.

I simply used the Fedora pkg mgr.

$ sudo dnf install coccinelle
$ sudo dnf builddep coccinelle
$  make coccicheck M=drivers/staging/ | grep -i warning

Here's how you might drill down further on a couple of the reports warning about sizeof() and suggesting min() usage.

Look up: what the functions expect, related merged patches, and the lore history of those merged patches. Lore history is interesting because you can see the questions that were asked/answered before the final patch was merged.

Something like this:

coccicheck reports:
drivers/staging/r8188eu/hal/rtl8188e_hal_init.c:415:77-80: WARNING: Use correct pointer type argument for sizeof drivers/staging/r8188eu/hal/rtl8188e_hal_init.c:100:77-80: WARNING: Use correct pointer type argument for sizeof

So, I do this:

$ git log --oneline | grep sizeof | grep staging

Then I go over to lore staging archive [1], and search on the subject line of a few of the patches of interest.

[1] https://lore.kernel.org/linux-staging/

The min() warning may be a good Outreachy patch also:
drivers/staging/most/video/video.c:176:22-23: WARNING opportunity for min() Just like with sizeof....learn from the history using