[PATCH 3.18 51/54] Staging: lustre: remove two build warnings
From: Greg Kroah-Hartman
Date: Tue Dec 11 2018 - 11:21:09 EST
3.18-stable review patch. If anyone has any objections, please let me know.
From: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
[for older kernels only, lustre has been removed from upstream]
When someone writes:
strncpy(dest, source, sizeof(source));
they really are just doing the same thing as:
but somehow they feel better because they are now using the "safe"
version of the string functions. Cargo-cult programming at its
gcc-8 rightfully warns you about doing foolish things like this. Now
that the stable kernels are all starting to be built using gcc-8, let's
get rid of this warning so that we do not have to gaze at this horror.
To dropt the warning, just convert the code to using strcpy() so that if
someone really wants to audit this code and find all of the obvious
problems, it will be easier to do so.
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
drivers/staging/lustre/lustre/lmv/lmv_obd.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
@@ -736,7 +736,7 @@ repeat_fid2path:
memmove(ptr + strlen(gf->gf_path) + 1, ptr,
- strncpy(ptr, gf->gf_path, strlen(gf->gf_path));
+ strcpy(ptr, gf->gf_path);
ptr += strlen(gf->gf_path);
*ptr = '/';