Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp242207imm; Thu, 12 Jul 2018 18:27:53 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcjGbl61PD1Shzqp3i/elw2NSuIiFQR+HuXu9tNaOO9WDojSCraLE1qr1aMVtFDb++kUMIP X-Received: by 2002:a17:902:5481:: with SMTP id e1-v6mr4345090pli.7.1531445273874; Thu, 12 Jul 2018 18:27:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531445273; cv=none; d=google.com; s=arc-20160816; b=Ioef/M9Zgxg7G741jxrssbrnNwccGutBOUI6LfQ7carGu/5uol/enCfvz01o6IeSzD AkCN/9fNki38t6V5K7Xh/b1Fii+bc40hEsup0Hxz+ASYVujmFnF2OAYbYRI1fWgE3mLG qKLSmYQgdFKqDSVw04Cs2AZWaOkLO57qQ0/gLZ0oZ+hjtPjevD4p3bSGd/jvRWQpJUxS Jzxb62ziQI9e2+kk8cQFRbzZVqaM/pAW5PGu3dqV06MMnjw/H9iSd561uueBFAs+ehZN V0mRbtw0JQF+3NKGmUbfKHJDUxdOe8zzvqsOmUJ4e/WASaGpecfrJ3U01oj792VJFcOO NfVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:references:in-reply-to:message-id:date :subject:cc:from:arc-authentication-results; bh=I3qU3xo8kSczzqMy8WaBdeia2bRVUM/4SXTSor0B5B0=; b=PgeQ3wrzE+eUu5EJ/OHoMHUqcsBXtFEVzowWmxj0hCtBg0nlxm2r7oD+u/OZy1BGZj tlU8IvgwdVwMwWiVReYySwCcAKdTjrMoQEFmZR5kycvI1HMQ8ppUu8vrd4C04j/1neCv Z26/DA8xIadxWW5McQCEakjQsh5YrzeTIUcIYjqoszElLFl+LHJsG/CimLWxaZKoZep5 IKVJcokhSRxunq0HvzYe+3xlmXLm0ghyqJYSL8p476/X5XUBJwq2voyA6FkdD9MRM2Ln ix/LrmCmNNEC/VLoN/eaIashMFnMzHJ+obCNNJ18ODcn1ng9dAFmwWf8tlVB9VfZntwr KIuA== 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 w185-v6si21487859pgb.599.2018.07.12.18.27.39; Thu, 12 Jul 2018 18:27:53 -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 S2388173AbeGMBiS (ORCPT + 99 others); Thu, 12 Jul 2018 21:38:18 -0400 Received: from nautica.notk.org ([91.121.71.147]:43046 "EHLO nautica.notk.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387896AbeGMBiR (ORCPT ); Thu, 12 Jul 2018 21:38:17 -0400 Received: by nautica.notk.org (Postfix, from userid 1001) id 3A452C02C; Fri, 13 Jul 2018 03:26:05 +0200 (CEST) From: Dominique Martinet Cc: Dominique Martinet , Thomas Gleixner , Greg Kroah-Hartman , Philippe Ombredanne , Kate Stewart , linux-kernel@vger.kernel.org Subject: [PATCH 16/18] tools/accounting: change strncpy+truncation to strlcpy Date: Fri, 13 Jul 2018 03:26:03 +0200 Message-Id: <1531445163-19829-1-git-send-email-asmadeus@codewreck.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1531444483-17338-1-git-send-email-asmadeus@codewreck.org> References: <1531444483-17338-1-git-send-email-asmadeus@codewreck.org> To: unlisted-recipients:; (no To-header on input) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Generated by scripts/coccinelle/misc/strncpy_truncation.cocci Signed-off-by: Dominique Martinet --- Please see https://marc.info/?l=linux-kernel&m=153144450722324&w=2 (the first patch of the serie) for the motivation behind this patch tools/accounting/getdelays.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tools/accounting/getdelays.c b/tools/accounting/getdelays.c index 9f420d98b5fb..66817a7a4fce 100644 --- a/tools/accounting/getdelays.c +++ b/tools/accounting/getdelays.c @@ -314,8 +314,7 @@ int main(int argc, char *argv[]) err(1, "Invalid rcv buf size\n"); break; case 'm': - strncpy(cpumask, optarg, sizeof(cpumask)); - cpumask[sizeof(cpumask) - 1] = '\0'; + strlcpy(cpumask, optarg, sizeof(cpumask)); maskset = 1; printf("cpumask %s maskset %d\n", cpumask, maskset); break; -- 2.17.1