-------------
Linus’s Rant RE-Rewritten
This is the old code in net/ipv6/ip6_output.c:
mtu -= hlen + sizeof(struct frag_hdr);
and this your replacement: if (overflow_usub(mtu, hlen + sizeof(struct frag_hdr), &mtu) || mtu <= 7)
goto fail_toobig;
The problem is that the overflow_usub() function is non-standard and requires special compiler support to generate reasonably efficient code. That function hasn't been used anywhere else in the code base before. Also, the code uses two conditionals. Here is how it should have been written: if (mtu < hlen + sizeof(struct frag_hdr) + 8)
goto fail_toobig;
mtu -= hlen + sizeof(struct frag_hdr);
It takes the same number of lines, doesn't need a little-known helper function, is clearer in its intent and is easier to read. There could still be overflow issues if the "hlen + xyz" expression overflows, but the "overflow_usub()" code has that same problem.Also, we are near to rc7 time, and we don't want conflicts at this point.
Thank you for submitting the code, but, for all the aforementioned reasons, I have to reject it and will do so for similar code in the future.
Those aren't weasel words, that's direct feedback.
The rewritten message clearly indicates a rejection of the submitted code, so directing the submitter to consider the example replacement seems a constructive and appropriate response.
The rewritten version neglects the criticism that the submitted code is too fiddly relying on the short-circuit of the || operator, but Linus failed to mention that as well :p
Deleted comment
Linus isn't just talking to the submitter. He knows perfectly well that his rants will be read by everyone in the community. A polite "plz fix it" will go unnoticed.
I'm not sure whether there's some common understanding that his rants are just an act, to get everyone to read them. Or if Linus thinks that it's actually justified to be a dick when people fuck up. But I think it's a factor - when Linus rants, everyone pays attention, and Linus will certainly be aware of that.
Yes, it would be nice if people paid attention to him being polite. But if he wrote it like the rewritten suggestion, only a handful of people would read it, and they're probably not the the type of people who are making the mistakes to begin with.
If people ask Linus to do anything, ask him to politely reach out to the people he flames, and let them know that the reason for his grandstanding is mostly just to grab eyeballs. It raises an important issue, and while he may be annoyed at the bad submit the level of vitriol is only really there to grab attention.
Imagine if all tech managers in behaves like him, I think most of us would be in other industries.