summaryrefslogtreecommitdiff
path: root/net/sunrpc/sysctl.c
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2020-11-06 23:50:39 +0300
committerJ. Bruce Fields <bfields@redhat.com>2020-11-09 00:28:25 +0300
commitae2975046dbc65855c217fe6fbd5b33140c5ff18 (patch)
tree55063f517533075f5e84dbd4b8c064f69926f0fe /net/sunrpc/sysctl.c
parentd435c05ab0197ee302290e1cee3f2d9c9024a64f (diff)
downloadlinux-ae2975046dbc65855c217fe6fbd5b33140c5ff18.tar.xz
net/sunrpc: fix useless comparison in proc_do_xprt()
In the original code, the "if (*lenp < 0)" check didn't work because "*lenp" is unsigned. Fortunately, the memory_read_from_buffer() call will never fail in this context so it doesn't affect runtime. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'net/sunrpc/sysctl.c')
-rw-r--r--net/sunrpc/sysctl.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/net/sunrpc/sysctl.c b/net/sunrpc/sysctl.c
index 5c9f5bca4d99..3aad6ef18504 100644
--- a/net/sunrpc/sysctl.c
+++ b/net/sunrpc/sysctl.c
@@ -63,19 +63,20 @@ static int proc_do_xprt(struct ctl_table *table, int write,
void *buffer, size_t *lenp, loff_t *ppos)
{
char tmpbuf[256];
- size_t len;
+ ssize_t len;
if (write || *ppos) {
*lenp = 0;
return 0;
}
len = svc_print_xprts(tmpbuf, sizeof(tmpbuf));
- *lenp = memory_read_from_buffer(buffer, *lenp, ppos, tmpbuf, len);
+ len = memory_read_from_buffer(buffer, *lenp, ppos, tmpbuf, len);
- if (*lenp < 0) {
+ if (len < 0) {
*lenp = 0;
return -EINVAL;
}
+ *lenp = len;
return 0;
}