KSPP / linux

Linux kernel source tree (Kernel Self Protection Project)
https://kernsec.org/wiki/index.php/Kernel_Self_Protection_Project
Other
83 stars 5 forks source link

pre-"case" switch variable declarations are not covered by -fauto-var-init #125

Open kees opened 3 years ago

kees commented 3 years ago

In code like this, var is not auto-initialized:

switch (opt) {
    int var;

    case 1:
        /* do things */
        break;
    default:
        /* other stuff */
        break;
}

All instances were removed from the kernel, but nothing keeps them from coming back. Perhaps add a Coccinelle script until this is fixed in the compilers?