Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp242581imm; Thu, 12 Jul 2018 18:28:26 -0700 (PDT) X-Google-Smtp-Source: AAOMgpejOM8i9k1BwOByCeA38hgbzQS59d6ePYvSTNVCXNm9ZAZjS+ntkHY0mD79xhrBAmpjLNrY X-Received: by 2002:a17:902:4081:: with SMTP id c1-v6mr4304956pld.169.1531445306663; Thu, 12 Jul 2018 18:28:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531445306; cv=none; d=google.com; s=arc-20160816; b=EhLXaJ75K96PJJkjY+RNqyvoU+Txy7Xd0xXnpk0qKaR1nY4edMA0DoRf21IzFO9FBK wmYCle8/pOJD64Er+hnCbe6LzW+c7PKOJtcNPnTvOeK5u/edsqvmgr9WidyojSdGtIaz hJzkrOG4a5SXrmAkZTmlbjXRLNroweGde/+7njB9rNU7nt0JE5z3JCPoXDUdyZ4K+ENn RhB9e+zzi2JRJbnk+JPn/RfVgX7m21gHR4iitPf6cF2m9TNIwV9KDe7d660R4sAmLMMQ akbVdvGeWouLXqmOmGbCWI8EHZ7hwt2xTQd4Mv+FDdKwjZ/v6qNDv8Z1NIDDejAZoXII 276w== 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=MGAiwyo+FA/mMHZOUNjdj/c4t8hVlJL8s731D4JloQU=; b=OPtVxZd8/6l+wFwzjWaidJl1F5419WgbUs8nHKgab+i6oMfU2EH+Pq2MDxINrKvu/z u1VEJidVIOgaj4yQUKsEAVUW8QCw+X7I7rp0de/sPyEB1ZE6DwhdvwA3ojwUJlVGqxEd SOIuSb/20LYreC6198W0ffyraBdY1lHnCBTunmg1jX1Bvs11SXahIr2S7frCYUdnJ3x4 14ZZ4YVWnxFbTM5R3VpNEknQP/Lu4CCuioAj/6+yfke399O+aU1bUSLQtQcrY7okF1nE fJ6eeXQ/w4SJ1VhF95KZg6ExbtF2QRJHIuaebvjcS+XtG3dtf+5r+0Ia56w4ZI7QB/eK 96YA== 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 o15-v6si14819135pgq.236.2018.07.12.18.28.11; Thu, 12 Jul 2018 18:28:26 -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 S2388201AbeGMBiY (ORCPT + 99 others); Thu, 12 Jul 2018 21:38:24 -0400 Received: from nautica.notk.org ([91.121.71.147]:43063 "EHLO nautica.notk.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388192AbeGMBiX (ORCPT ); Thu, 12 Jul 2018 21:38:23 -0400 Received: by nautica.notk.org (Postfix, from userid 1001) id 00C3DC029; Fri, 13 Jul 2018 03:26:10 +0200 (CEST) From: Dominique Martinet Cc: Dominique Martinet , Thomas Renninger , Shuah Khan , Colin Ian King , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 18/18] cpupower: change strncpy+truncation to strlcpy Date: Fri, 13 Jul 2018 03:26:09 +0200 Message-Id: <1531445169-19912-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/power/cpupower/bench/parse.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tools/power/cpupower/bench/parse.c b/tools/power/cpupower/bench/parse.c index 9ba8a44ad2a7..1566b89989b2 100644 --- a/tools/power/cpupower/bench/parse.c +++ b/tools/power/cpupower/bench/parse.c @@ -221,9 +221,8 @@ int prepare_config(const char *path, struct config *config) sscanf(val, "%u", &config->cpu); else if (strcmp("governor", opt) == 0) { - strncpy(config->governor, val, + strlcpy(config->governor, val, sizeof(config->governor)); - config->governor[sizeof(config->governor) - 1] = '\0'; } else if (strcmp("priority", opt) == 0) { -- 2.17.1