Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

staging: lustre: libcfs: Prevent harmless read underflow

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>

authored by

Dan Carpenter and committed by
Greg Kroah-Hartman
134aecbc a81200b5

+1 -1
+1 -1
drivers/staging/lustre/lnet/libcfs/tracefile.c
··· 785 785 return -EFAULT; 786 786 787 787 nob = strnlen(knl_buffer, usr_buffer_nob); 788 - while (nob-- >= 0) /* strip trailing whitespace */ 788 + while (--nob >= 0) /* strip trailing whitespace */ 789 789 if (!isspace(knl_buffer[nob])) 790 790 break; 791 791