From: Greg Kroah-Hartman Date: Tue, 11 Dec 2018 13:11:21 +0000 (+0100) Subject: 4.9-stable patches X-Git-Tag: v4.19.9~10 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4cd493930b6a35f74f455cfdaaa2db1e0ca610d6;p=thirdparty%2Fkernel%2Fstable-queue.git 4.9-stable patches added patches: staging-lustre-remove-two-build-warnings.patch --- diff --git a/queue-4.9/series b/queue-4.9/series index a345c357ff4..eb14eb7d2d7 100644 --- a/queue-4.9/series +++ b/queue-4.9/series @@ -36,3 +36,4 @@ sr-pass-down-correctly-sized-scsi-sense-buffer.patch swiotlb-clean-up-reporting.patch vsock-lookup-and-setup-guest_cid-inside-vhost_vsock_.patch vhost-vsock-fix-use-after-free-in-network-stack-call.patch +staging-lustre-remove-two-build-warnings.patch diff --git a/queue-4.9/staging-lustre-remove-two-build-warnings.patch b/queue-4.9/staging-lustre-remove-two-build-warnings.patch new file mode 100644 index 00000000000..1a4845b335a --- /dev/null +++ b/queue-4.9/staging-lustre-remove-two-build-warnings.patch @@ -0,0 +1,59 @@ +From gregkh@linuxfoundation.org Tue Dec 11 14:07:57 2018 +From: Greg KH +Date: Tue, 11 Dec 2018 13:50:37 +0100 +Subject: Staging: lustre: remove two build warnings +To: linux-kernel@vger.kernel.org +Cc: stable@vger.kernel.org +Message-ID: <20181211125037.GA25594@kroah.com> +Content-Disposition: inline + +From: Greg Kroah-Hartman + +[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: Greg Kroah-Hartman + +--- + drivers/staging/lustre/lnet/lnet/config.c | 3 +-- + drivers/staging/lustre/lustre/lmv/lmv_obd.c | 2 +- + 2 files changed, 2 insertions(+), 3 deletions(-) + +--- a/drivers/staging/lustre/lnet/lnet/config.c ++++ b/drivers/staging/lustre/lnet/lnet/config.c +@@ -354,8 +354,7 @@ lnet_parse_networks(struct list_head *ni + CERROR("Can't allocate net interface name\n"); + goto failed; + } +- strncpy(ni->ni_interfaces[niface], iface, +- strlen(iface)); ++ strcpy(ni->ni_interfaces[niface], iface); + niface++; + iface = comma; + } while (iface); +--- a/drivers/staging/lustre/lustre/lmv/lmv_obd.c ++++ b/drivers/staging/lustre/lustre/lmv/lmv_obd.c +@@ -684,7 +684,7 @@ repeat_fid2path: + memmove(ptr + strlen(gf->gf_path) + 1, ptr, + 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 = '/'; + }