3 ms·
> By the way, I think Linus is full of crap: while the line at issue isn't great, the use of those overflow-arithmetic functions in general is a great idea, con
by strcat 11y ago
> By the way, I think Linus is full of crap: while the line at issue isn't great, the use of those overflow-arithmetic functions in general is a great idea, considering how easy it is to screw up a manual overflow check in C, and how ridiculously frequently this results in real security vulnerabilities (among other issues), including of course in Linux in the past. But that's mostly orthogonal to his manner of expression.
The overflow checking functions are very compelling for unsigned multiplication and all of the signed operations. It makes sense for unsigned addition and subtraction if it's already an existing pattern for the difficult cases, but I don't think it was a good way to introduce the functions. These are definitely the most optimized way to perform the checks across the board though, especially for multiplication. Linus is just making incorrect assumptions based on his lack of faith in compilers.