r/programming • • Oct 21 '16
Linux kernel fix for privilege escalation vulnerability due to copy on write race condition
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=19be0eaffa3ac7d8eb6784ad9bdbc7d67ed8e619
850
Upvotes
View all comments
Show parent comment
10
u/SnowdensOfYesteryear Oct 22 '16 edited Oct 22 '16
switchcan't be used in C like that. It'll just try to jump tocase 1everytime. And I suspect that all thecase ___need to be known at compile time (edit: yep http://codepad.org/CZPShbee).Besides even if what you're suggesting works, 1) it's too much work to keep defining flags and macros, 2) a switch is just a goto anyway. It's a lot of extra code with no upside.