Commit 98e14d11 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman Committed by Kleber Sacilotto de Souza

Staging: lustre: remove two build warnings

BugLink: https://bugs.launchpad.net/bugs/1811077

[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:
	strcpy(dest, source);
but somehow they feel better because they are now using the "safe"
version of the string functions.  Cargo-cult programming at its
finest...

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: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarJuerg Haefliger <juergh@canonical.com>
Signed-off-by: default avatarKleber Sacilotto de Souza <kleber.souza@canonical.com>
parent 61153133
...@@ -700,7 +700,7 @@ static int lmv_fid2path(struct obd_export *exp, int len, void *karg, void *uarg) ...@@ -700,7 +700,7 @@ static int lmv_fid2path(struct obd_export *exp, int len, void *karg, void *uarg)
memmove(ptr + strlen(gf->gf_path) + 1, ptr, memmove(ptr + strlen(gf->gf_path) + 1, ptr,
strlen(ori_gf->gf_path)); strlen(ori_gf->gf_path));
strncpy(ptr, gf->gf_path, strlen(gf->gf_path)); strcpy(ptr, gf->gf_path);
ptr += strlen(gf->gf_path); ptr += strlen(gf->gf_path);
*ptr = '/'; *ptr = '/';
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment