]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
staging: lustre: libcfs: Prevent harmless read underflow
authorDan Carpenter <dan.carpenter@oracle.com>
Mon, 22 Jan 2018 10:26:14 +0000 (13:26 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 22 Jan 2018 10:40:49 +0000 (11:40 +0100)
Because this is a post-op instead of a pre-op, then it means we check
if knl_buffer[-1] is a space.  It doesn't really hurt anything, but
it causes a static checker warning so let's fix it.

Fixes: d7e09d0397e8 ("staging: add Lustre file system client support")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/lustre/lnet/libcfs/tracefile.c

index da2844f37edfacb242a8acb99e1ce0ad3c509300..57913aae1d881f8e42ece80c5ff9907ba4b4c57b 100644 (file)
@@ -785,7 +785,7 @@ int cfs_trace_copyin_string(char *knl_buffer, int knl_buffer_nob,
                return -EFAULT;
 
        nob = strnlen(knl_buffer, usr_buffer_nob);
-       while (nob-- >= 0)                    /* strip trailing whitespace */
+       while (--nob >= 0)                    /* strip trailing whitespace */
                if (!isspace(knl_buffer[nob]))
                        break;