Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp7103117ybi; Mon, 8 Jul 2019 14:39:31 -0700 (PDT) X-Google-Smtp-Source: APXvYqw6RnVnuu9urNX9RDqM4nceu9iwpCbotmV625jLXkFGEMYhvocPnr0Gh+AbSKIP+7L0gGGN X-Received: by 2002:a17:90a:8a17:: with SMTP id w23mr27750294pjn.139.1562621971447; Mon, 08 Jul 2019 14:39:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562621971; cv=none; d=google.com; s=arc-20160816; b=yD3zz2KwAT6K9VkKOiFue8Hym+SzilXP0pbBO3AKDWciwkQxbHmccV3Hf7lRsH7C4L lrpUYBIaFhLakK3v9XeNPEAMPkYqn61W+h6IoehuqJIBmobWXiji5hOmT/sYVyW93j8G Oo88v1P2zzzOgMV6cfExtYEWF/513lNtuVCG0C6lIMtDLAv9dMpAQ/CMQoLd4cNlR/GJ lJCRXjw8wP3dIykxnjzfNwinJ0sMOQJCTEC38K8gf5r2n7YYjbsICs1kfa0K9h5xVNLI wlOnK3w++RZpHqhWa48++2zdlBu7SIlFKhBJ4Y54YD9Av6IiqdysFoEnj1yEpC8sEngh pD7A== 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=/QiLJOImwewsT4ZcvRz/pZTFIsrwQJ1pA3bFtFsT39U=; b=yaJJ+O4Lc3A95+Jb2qXawiJZth5LG92cHVEyesK8WRW97C23xGDN0o14FRhtqtMjtw 2vLeKFlMRKxMyAymO5gb/1JAC9mVvrp8IC6J1fW0fxTnwTDYm3M60Ne6cr00I/A9wW54 IQ8TrXkiunH0YeC7g4a7/uzihHGN2RyulMQthv1CrZ+NeBIG68qrsvFP8Hk4V9I2yHpt Hjw0/XHz1BhOS2qGm+FyBt3MDpJ17iu8aAdbgyoarG24tk2o7obNUDr+sUQOBftwYGim KIKg+4cdMUENL+HmpJFFhbgwResfUCcbIglP5ctQX+VqdSQpd+86egOxFmlpowApsoY4 Ltkg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=cLhk2dhx; 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 x61si1992579plb.336.2019.07.08.14.39.15; Mon, 08 Jul 2019 14:39:31 -0700 (PDT) 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=cLhk2dhx; 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 S1732898AbfGHPRs (ORCPT + 99 others); Mon, 8 Jul 2019 11:17:48 -0400 Received: from mail.kernel.org ([198.145.29.99]:41224 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730511AbfGHPRp (ORCPT ); Mon, 8 Jul 2019 11:17:45 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.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 E88E6216C4; Mon, 8 Jul 2019 15:17:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1562599064; bh=A3B+CCe3/MsWOjNTZZQCMTN4wd4E3BxnZap+XVg5Xew=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cLhk2dhxRl9B9ZHxxLXKwzrpblKTAUCEmfCGxhRJ+FUN1A9b950KdsXebcWQmwW6q Y690i+S8veWtCIJtLT1Y97aimmYf9+cTJN9F4QbFyKbxJ+UKGnwjjwEWjCG2FwI/Ik Kv05fvGbZJB2VQWcl2LYZzU7eH2b/mTHPrYClIUM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Adrian Hunter , Jiri Olsa , Namhyung Kim , Arnaldo Carvalho de Melo Subject: [PATCH 4.4 30/73] perf help: Remove needless use of strncpy() Date: Mon, 8 Jul 2019 17:12:40 +0200 Message-Id: <20190708150522.770686017@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190708150513.136580595@linuxfoundation.org> References: <20190708150513.136580595@linuxfoundation.org> User-Agent: quilt/0.66 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 From: Arnaldo Carvalho de Melo commit b6313899f4ed2e76b8375cf8069556f5b94fbff0 upstream. Since we make sure the destination buffer has at least strlen(orig) + 1, no need to do a strncpy(dest, orig, strlen(orig)), just use strcpy(dest, orig). This silences this gcc 8.2 warning on Alpine Linux: In function 'add_man_viewer', inlined from 'perf_help_config' at builtin-help.c:284:3: builtin-help.c:192:2: error: 'strncpy' output truncated before terminating nul copying as many bytes from a string as its length [-Werror=stringop-truncation] strncpy((*p)->name, name, len); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ builtin-help.c: In function 'perf_help_config': builtin-help.c:187:15: note: length computed here size_t len = strlen(name); ^~~~~~~~~~~~ Cc: Adrian Hunter Cc: Jiri Olsa Cc: Namhyung Kim Fixes: 078006012401 ("perf_counter tools: add in basic glue from Git") Link: https://lkml.kernel.org/n/tip-2f69l7drca427ob4km8i7kvo@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Greg Kroah-Hartman --- tools/perf/builtin-help.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/tools/perf/builtin-help.c +++ b/tools/perf/builtin-help.c @@ -179,7 +179,7 @@ static void add_man_viewer(const char *n while (*p) p = &((*p)->next); *p = zalloc(sizeof(**p) + len + 1); - strncpy((*p)->name, name, len); + strcpy((*p)->name, name); } static int supported_man_viewer(const char *name, size_t len)