The kstrtol_from_user() does much more than strtol. That "from_user" part is critical. It is accessing data from an untrusted source. It must be prepared for that address to segfault, and make sure it does not belong to something that the user should not be touching.
For your second question, well, that's the point for switching back to -O2 :) The idea was that a smaller kernel would have less pressure on the instruction cache and be a bigger win in performance. Anytime you take a miss in the instruction cache, the CPU must stall to retrieve the memory that contains the instructions. As CPUs are much faster than memory access, the less you miss instruction cache, the faster you run. But if the -Os is not affecting this much at all, there's no point in using it.
Copyright © 2018, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds