Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2996257imu; Mon, 19 Nov 2018 09:08:14 -0800 (PST) X-Google-Smtp-Source: AJdET5c7v7r/palYOjdRl6uiN7c2pgB3U6OduB+kDhaOpK7aMfcltC1FiaVUIvLXp+FDFQtWrZzy X-Received: by 2002:a63:cc12:: with SMTP id x18mr20635461pgf.33.1542647294437; Mon, 19 Nov 2018 09:08:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542647294; cv=none; d=google.com; s=arc-20160816; b=wAetSw6at9i0aJWJbLvqsZhkBTeae2w01xK+ohnKE3X6pSkzHTiOcl5eCYIcu44X/K k1QdCp3BgwW/n0uU7MretbEzW8itWhBJMMnkmyx62TZ1bBqnOoKae3EtGtuADMjtYY20 wQxmCKqFpD5Q3rFpp7R0sA6DDdzVpXMNI2cyh7dftkefXdy7Wa8yjfJ5aKR1pJCCpV2j yafIg7VuQm6us8vcgfFcc1gDq+KoAgyuhl3QCImgnvhpGICXQqlDZrH/rq85eM0UKa9V nG5wUXyUl4b2cvQ/ekj5t5gPbMn4QP9sCFUi8d8JPo5s0e2T3D3dVjiMtjhyKRYCZxBz qa6g== 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=ahDoVndCP8nnReDbhYHkE05LpDtei1VNkV9bjtz6L0c=; b=F/6MACYM6HiGPK3Y6bocoPR/vinOPFu0qaBqG4d/z+IHB4dOuC8Msn0ES7jZye/eu/ 1misX7PnqoeYhSFeBMKiogyYzrCZkABAg/N97GDeCBXgPRWy/AJO4t7w2jU245Gt7SAG qoLf1TYVkGV/t943g1gzfxJ+Q08i1sCvuQT8SOz0GZRMW3r2WzsjJP37SsWXU6s3YVFZ xFlfN78+neEo9XbGYVjOkc5FCjocMJto3HssK1QBpaIRlLmssMujzsNhMBv2TJsdj4ja POyl/Dy1E27iiCIdQyQLgcTQKFO4cKwTieTrjuVImKZODb+xwpLS7jA8oUNV22I2qx5t NMDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=xKxjPM3Z; 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 16si39544388pgh.58.2018.11.19.09.07.58; Mon, 19 Nov 2018 09:08:14 -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=xKxjPM3Z; 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 S2405988AbeKTDbA (ORCPT + 99 others); Mon, 19 Nov 2018 22:31:00 -0500 Received: from mail.kernel.org ([198.145.29.99]:46216 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405956AbeKTDa7 (ORCPT ); Mon, 19 Nov 2018 22:30:59 -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 DFBF6214D9; Mon, 19 Nov 2018 17:06:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1542647201; bh=39zB7ELhkx+qLBoqkPKzNt/6N2o28ZWmt87T8A6PwxM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xKxjPM3Zjgs5NmtRH4fvY33ZKelJe/yZ+/IfnNAR2F1PI5f6BPmTtgw5kX7+ziXn0 Iuup8Hjls5432I05yGJbgyYV3yigpjwz2oJ5dGK7wOZz8zMbyuVAmn0Mp926+2UvRM WfWojTCuQiQrdCJdCEryZDbA6UP0ja5Lzi+mW9YE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Guenter Roeck , Christoph Hellwig , Nobuhiro Iwamatsu Subject: [PATCH 3.18 89/90] configfs: replace strncpy with memcpy Date: Mon, 19 Nov 2018 17:30:11 +0100 Message-Id: <20181119162634.026898317@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181119162620.585061184@linuxfoundation.org> References: <20181119162620.585061184@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review 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 3.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Guenter Roeck commit 1823342a1f2b47a4e6f5667f67cd28ab6bc4d6cd upstream. gcc 8.1.0 complains: fs/configfs/symlink.c:67:3: warning: 'strncpy' output truncated before terminating nul copying as many bytes from a string as its length fs/configfs/symlink.c: In function 'configfs_get_link': fs/configfs/symlink.c:63:13: note: length computed here Using strncpy() is indeed less than perfect since the length of data to be copied has already been determined with strlen(). Replace strncpy() with memcpy() to address the warning and optimize the code a little. Signed-off-by: Guenter Roeck Signed-off-by: Christoph Hellwig Signed-off-by: Nobuhiro Iwamatsu Signed-off-by: Greg Kroah-Hartman --- fs/configfs/symlink.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/fs/configfs/symlink.c +++ b/fs/configfs/symlink.c @@ -64,7 +64,7 @@ static void fill_item_path(struct config /* back up enough to print this bus id with '/' */ length -= cur; - strncpy(buffer + length,config_item_name(p),cur); + memcpy(buffer + length, config_item_name(p), cur); *(buffer + --length) = '/'; } }