ossf / wg-best-practices-os-developers

The Best Practices for OSS Developers working group is dedicated to raising awareness and education of secure code best practices for open source developers.
https://openssf.org
Apache License 2.0
762 stars 130 forks source link

C fallthrough: Which version of the Linux kernel? #480

Closed david-a-wheeler closed 5 months ago

david-a-wheeler commented 6 months ago

The current text says, "The C17 standard does not provide a mechanism to mark intentional fallthroughs....". It then notes the Linux kernel. Is it version 5.10 or 6.4 that started using this?

06kellyjac commented 5 months ago

Commits I've found for fallthrough

Could be missing some bits. I've not found a reference around 5.10


https://cdn.kernel.org/pub/linux/kernel/v5.x/ChangeLog-5.10 if you want to ctrl+f through for fallthrough

docs:

not here yet https://www.kernel.org/doc/html/v5.1/process/deprecated.html?highlight=fallthrough#implicit-switch-case-fall-through

starts to appear https://www.kernel.org/doc/html/v5.3/process/deprecated.html?highlight=fallthrough#implicit-switch-case-fall-through

https://www.kernel.org/doc/html/v5.7/process/deprecated.html?highlight=fallthrough#implicit-switch-case-fall-through

https://www.kernel.org/doc/html/v5.10/process/deprecated.html?highlight=fallthrough#implicit-switch-case-fall-through

https://www.kernel.org/doc/html/v6.4/process/deprecated.html?highlight=fallthrough#implicit-switch-case-fall-through

https://www.kernel.org/doc/html/v6.9/process/deprecated.html?highlight=fallthrough#implicit-switch-case-fall-through

thomasnyman commented 5 months ago

I am also not sure where the reference to 5.10 originates from. I was responsible for adding the last sentence of the section, referring to 6.4 after I also found https://github.com/torvalds/linux/commit/192614010a5052fe92611c7076ef664fd9bb60e8 to be the first commit with fallthrough in the form the guide originally referred to.

Addressing this inconsistency in #494 that also removes the redundant note below the example.