Thread (9 messages) 9 messages, 4 authors, 2021-05-31

Re: [PATCH net] udp: fix the len check in udp_lib_getsockopt

flat view

From: Xin Long <lucien.xin@gmail.com>
Date: 2021-05-31 02:02:58

On Sun, May 30, 2021 at 9:31 PM David Ahern [off-list ref] wrote:
On 5/29/21 10:47 AM, Xin Long wrote:
quoted
On Fri, May 28, 2021 at 9:57 PM David Ahern [off-list ref] wrote:
quoted
On 5/28/21 7:47 PM, Xin Long wrote:
quoted
The partial byte(or even 0) of the value returned due to passing a wrong
optlen should be considered as an error. "On error, -1 is returned, and
errno is set appropriately.". Success returned in that case only confuses
the user.
It is feasible that some app could use bool or u8 for options that have
0 or 1 values and that code has so far worked. This change would break that.
Got it.
Not sure if it's possible or necessary to also return -EINVAL if optlen == 0
do_tcp_getsockopt for example does not fail on optlen 0; no reason to
make this one fail.
I was about to say do_tcp_getsockopt has the same issue. :-)
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help