mirror of
https://github.com/tbsdtv/linux_media.git
synced 2025-07-23 20:51:03 +02:00
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>
This commit is contained in:
committed by
J. Bruce Fields
parent
d435c05ab0
commit
ae2975046d
@@ -63,19 +63,20 @@ static int proc_do_xprt(struct ctl_table *table, int write,
|
|||||||
void *buffer, size_t *lenp, loff_t *ppos)
|
void *buffer, size_t *lenp, loff_t *ppos)
|
||||||
{
|
{
|
||||||
char tmpbuf[256];
|
char tmpbuf[256];
|
||||||
size_t len;
|
ssize_t len;
|
||||||
|
|
||||||
if (write || *ppos) {
|
if (write || *ppos) {
|
||||||
*lenp = 0;
|
*lenp = 0;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
len = svc_print_xprts(tmpbuf, sizeof(tmpbuf));
|
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;
|
*lenp = 0;
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
*lenp = len;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user