Messages in this thread | | | From | Ajay Garg <> | Date | Wed, 10 Nov 2021 15:02:52 +0530 | Subject | Re: [PATCH] tty: vt: keyboard: do not copy an extra-byte in copy_to_user |
| |
> > > > That's right Pavel. > > Every function must work correctly as it "advertises", instead of > > relying on "chancy correctness" of the calls leading to the method. > > That is not how the kernel works, sorry. Otherwise every function would > have to always verify all parameters passed to them, causing slow downs > and redundant checks everywhere. >
Hmm, agreed. Every cycle saved in the kernel is performance gained.
That's why, the RFC for strlscpy [1] makes all the more sense, as it would save cpu cycles by removing the requirement to check the return-value for overflows/underflows (including the "issue" I am trying to address in this particular thread, and which actually lead to the RFC for strlscpy].
P.S. :
I am not an egoistic person, who wants to get into unnecessary fights just to upheld one's ego. All I am trying is to suggest improvements, that
* make things faster. * keeps code to as minimum as possible. * makes developers' lives as comfortable as possible.
[1] https://lore.kernel.org/linux-hardening/CAHP4M8WnLA0780yN+bpuuCtir+DLJRxe0atAiLbZO0bTGf6J-Q@mail.gmail.com/T/#m4a3f524eefe283a42430905fa4c0dfc2c37b2819
Thanks and Regards, Ajay
| |