Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3034659imu; Mon, 19 Nov 2018 09:38:52 -0800 (PST) X-Google-Smtp-Source: AJdET5cHlccdgwxi/Czien9MTZI4WgehTXTyTKj47dRcDI/LnflE3qgLWKYi+WP4PuVjK4nn0M2d X-Received: by 2002:a17:902:bf49:: with SMTP id u9mr22950136pls.4.1542649132587; Mon, 19 Nov 2018 09:38:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542649132; cv=none; d=google.com; s=arc-20160816; b=diYx7iO5rGxeeo425GQTyXSs+pJwzG84KVpBzX7adlXLUW8hX0MbY8mP7j4Mn5Ell1 uYHoGWL2Y6QCgP/RKfdtv7gsvn0A6tcKdnlmJqnKKo+eUjqUw0GQvnAxmVed0jfwylR3 0a+MIXVcUxeO4eJJu848OMQk1pBeXWTlBeAGDU4332jpkv7NRq/LvOTTco9//UMVNN2c 3gOiJIUXXI9DuSh+ppdmJzd8llZ92T2WLKmbfnOUSWG1iLjVxcRojDr4JIR/joOpHeo6 eDJvdffhBCmZe4sA6V0WvHRQcm3I1CRRkHMo/2Ne7/8lIjEzSw9dRhJZViXXX+FPhCeT 1m9w== 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=EWeCDH0qq7Kk8dViH2w5vyGVfVTAtkUSEQU+mQsS7cM=; b=IjHebRxhdwBq4PA6RkZRH5RiRcTw1yQfpH3LOHlJuqs9gPN0sy9bA7zUjYiF04GbHf fHz1jxR329z9cQkeDbPgZxcpXEQ5tA+fKE1TAd8qRwlzg1vGM6wRe+xPd1V17Hykd9iY YfP3SteuGQNt5YVZ2EXTdg5kr2iWQ4hc3b19KuzTjCtQ5TEDyPj4QrB19zqdWZikPzKz 0fEkZpiCLloRHWEeUWRwhQFckrg0DvlPxQ7/F4MQaFiEiYqEU7NqoaejUYo3YDE5DZDQ eO4uh3qcBv8Q5SNqCphfb0iMwZ84pN7Upe2M2qPTOFb/IR04jN6LZWNjwrS1K2D6stuB ww2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=fyoV10n5; 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 p22si36702473pgl.340.2018.11.19.09.38.36; Mon, 19 Nov 2018 09:38:52 -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=fyoV10n5; 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 S2390208AbeKTDPU (ORCPT + 99 others); Mon, 19 Nov 2018 22:15:20 -0500 Received: from mail.kernel.org ([198.145.29.99]:52902 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389271AbeKTDPU (ORCPT ); Mon, 19 Nov 2018 22:15:20 -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 6B218206BA; Mon, 19 Nov 2018 16:51:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1542646266; bh=LwKtGk0k9zGgAcI01g4/KdJEQPbuVVBJbpEqZV04DtI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fyoV10n5yZ4hy92yuxUWcrZ0cfIgdTKOJgLhqK6tzbIOB9Gsxy4xNFbi88S6qzAfl K/DpyIGFe8UDxrcNhL/G+lLZDfQAauhJz7iyv/cUR5djNrkmWFR/RUJTWtDgKuk9Kg AVkm3FJiil8i+1MHmEpdK8ogZ2YzrYsLnZdqbLEI= 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 4.14 100/124] configfs: replace strncpy with memcpy Date: Mon, 19 Nov 2018 17:29:14 +0100 Message-Id: <20181119162631.349737807@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181119162612.951907286@linuxfoundation.org> References: <20181119162612.951907286@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 4.14-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) = '/'; } }