Thread (3 messages) flat view 3 messages, 2 authors, 2015-10-20

RE: [PATCH] intel: i40e: fix confused code

From: Nelson, Shannon <hidden>
Date: 2015-10-19 16:56:20
Also in: intel-wired-lan, lkml

From: Rasmus Villemoes [mailto:linux@rasmusvillemoes.dk]
Sent: Saturday, October 17, 2015 1:58 PM
Subject: [PATCH] intel: i40e: fix confused code

This code is pretty confused. The variable name 'bytes_not_copied'
clearly indicates that the programmer knew the semantics of
copy_{to,from}_user, but then the return value is checked for being
negative and used as a -Exxx return value.

I'm not sure this is the proper fix, but at least we get rid of the
dead code which pretended to check for access faults.

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
I believe this patch is unnecessary: if the value is negative, then it already is an error code giving some potentially useful information.  When I dig into the copy_to_user() code, I see in the comments for put_user() that -EFAULT is the error being returned.  Also, if somewhere else along the line there is some other error, I'd prefer to return that value rather than stomp on it with my own error code.  

sln
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help