Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1318647yba; Tue, 2 Apr 2019 06:47:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqzx6w6f/ab5D8id+Qtq6ORCm2DeoO1VWhP2OD+gGctUF4zFNG69a8d+ckesnG5qIBpoNPqB X-Received: by 2002:aa7:9296:: with SMTP id j22mr41150928pfa.140.1554212861041; Tue, 02 Apr 2019 06:47:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554212861; cv=none; d=google.com; s=arc-20160816; b=sqhCsp4e7QrYtQpYDuaE4q9WFhaqRF3mqwAfFkJOW/Tu7RSPCpxXkec7upjH59XHWw 7XgOSunPHrTzSXFiDskb+V+IvJNskK5gFhYbIbMR+Ar4wBhKMk65OUz7HwnylGz42td2 bxDE9nfMx1UMbF5OPd79tzZhFXtxf6IYoWuIvJeIyUS1ELKg6uc38cY20Prw/9QVoOS0 t4qahgcvZeqdITA7baOrppuVw3gY2+WVhMW1LvszalsZsfTJ5aeydWVGyIh1OOPuOAK3 Hl+1RZ6grdEmxDxMhNrNbBs5ZgAShJBCJfYpRIdAy7YGPyNlLawTOREVHPILsc4NI+Ki ilgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition; bh=9hLqRK1fo0TLxjrZ3lkc8G432u07iCQjXCCA3uKP+ww=; b=V6hmG7tmM1sDVaj/kTNaBMC473m2iUuqouVpL/kNnOCfcrUip/3b3tuwT6d7lnVoIu PhH6HOT7GBCRZCqJbBU30eRRbiuEy4MP5Dpfb5QumKvF04IKZHq1Dw4DANsr51+9XZeN Q+zogO0oBXlLtKt73HIQRUSMpjUbd78Ez+FO6FevXjZpGK90e5kSMT1Ph41CEShgtecC ZSWW03W70NbSRe5fXBExp4JBUY4OxE1XAQM8UiZekOXa8r4EnAEFSLzvO6A/KK2ZhKJg bWyOWFyGuDbrJFK79AW+mciWVb2pnLcup2clpxhGbvdj5iuYh6b0yznnblSxQtoa7iqE bV+g== ARC-Authentication-Results: i=1; mx.google.com; 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 59si11476234plc.84.2019.04.02.06.47.25; Tue, 02 Apr 2019 06:47:41 -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; 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 S1732171AbfDBNqL (ORCPT + 99 others); Tue, 2 Apr 2019 09:46:11 -0400 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:43154 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731425AbfDBNkF (ORCPT ); Tue, 2 Apr 2019 09:40:05 -0400 Received: from [167.98.27.226] (helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hBJdw-0002oJ-Ov; Tue, 02 Apr 2019 14:40:01 +0100 Received: from ben by deadeye with local (Exim 4.92) (envelope-from ) id 1hBJdv-0004tZ-VJ; Tue, 02 Apr 2019 14:39:59 +0100 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, Denis Kirjanov , "Adrian Hunter" , "Arnaldo Carvalho de Melo" , "Jiri Olsa" , "Namhyung Kim" Date: Tue, 02 Apr 2019 14:38:27 +0100 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) X-Patchwork-Hint: ignore Subject: [PATCH 3.16 39/99] perf help: Remove needless use of strncpy() In-Reply-To: X-SA-Exim-Connect-IP: 167.98.27.226 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.16.65-rc1 review patch. If anyone has any objections, please let me know. ------------------ 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: Ben Hutchings --- 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 @@ -166,7 +166,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)