Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp837827imu; Tue, 11 Dec 2018 08:19:06 -0800 (PST) X-Google-Smtp-Source: AFSGD/X2FeSRq9h88ijPIkNtmmNqC0c4K+1DAf/SUR8gzvkVAJSL/+Rv6xGWsPf2apjxBupUQmp4 X-Received: by 2002:a63:af18:: with SMTP id w24mr15223656pge.385.1544545146264; Tue, 11 Dec 2018 08:19:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544545146; cv=none; d=google.com; s=arc-20160816; b=X4LFvDP9d+IWywWmat5ZMQW0tvHDtdFCHaUGVJJ9pKLdAe9dO5gbMW2McTccMtmkpF TdNeCMLIPZE0Cqbr07gqtqqKtioBz0BNd8QlZQfjQaECcjXDTE9EOufiqK8OLAOBcHD6 LE7Z/X4qW0EZDGcavCmQZ9CtTlx03RphFioWaQfNYvgR+D4gyPTxkQV3N0vU7zBu/b4v 89iBWGYge7gosogTxkXGxYVJ2Y9mdOlunlboFz0ulFpCjOyDM9/3MZyAeQq0JzInTB3Y GXKB6Ri76MTim4MdlNwxerHyWwdjNMN3vcSZwMdVqJGxemDH7TwGuCLVf0r23euORDaG Jppw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=2pl6Yf8r81rU69W6Q6xrgrDZn74XBHXun8F0W0gKgxs=; b=k0amS2aZKq0lq4ECrJcW/YHeBj2tocO+kYp+sokwpFEEIfqWY4DJlHFACbayvqtFDP 9sijw6NIBUiu2EUNs5cKyh9HKglTkvl2f2XAv/u3CyAzKmTYht29apJtvVXDy0cXGUQx cpSeR1dEo9vxFGC1nFgf5emAnzR8woWJlG7o1C7ZffpbhKBZe5iMr8vR8RCOuisEEe0y BL6/pgJGQReVpU9ZScO2LUDHlHYApQjfCHXTCfntafx1Ljh8SmRgwiCoM4LHGn12StrF WU56SXh5uftjNJ7GGsYABSfhiGWQ4vlOM8EopXGPADS6WAVV0OiwEDhh5+5pHnabzLRN dtBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=OWkoOyiX; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g71si12152983pgc.419.2018.12.11.08.18.51; Tue, 11 Dec 2018 08:19:06 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=OWkoOyiX; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728745AbeLKPsK (ORCPT + 99 others); Tue, 11 Dec 2018 10:48:10 -0500 Received: from mail.kernel.org ([198.145.29.99]:36474 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727974AbeLKPsI (ORCPT ); Tue, 11 Dec 2018 10:48:08 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 80B5C20870; Tue, 11 Dec 2018 15:48:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1544543288; bh=tkqLM6lFWKcrtN6dVs+yPtP+P5D4sR+NlWwH7jW6Pt8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OWkoOyiXieDoH/pEg674GgU27sU85tyBGRH9/MTKFHNX/MdPBebf+AIYgRAghfkin zQiJ4kwECxyt7SLv5xwgRz3TGsJ21mikG/PrL+puM4sl8k4Cknz/ziMMdtCYl4nG4a E2UC3ywPt2zGtD+x06xVc/0UfNHW9QCrxDmaAyAM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org Subject: [PATCH 4.4 83/91] Staging: lustre: remove two build warnings Date: Tue, 11 Dec 2018 16:41:42 +0100 Message-Id: <20181211151613.563272606@linuxfoundation.org> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20181211151606.026852373@linuxfoundation.org> References: <20181211151606.026852373@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ 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/lustre/lmv/lmv_obd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/staging/lustre/lustre/lmv/lmv_obd.c +++ b/drivers/staging/lustre/lustre/lmv/lmv_obd.c @@ -700,7 +700,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 = '/'; }