From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=3.0 tests=MAILING_LIST_MULTI,SPF_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A5549C6778A for ; Tue, 24 Jul 2018 16:31:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5E92820844 for ; Tue, 24 Jul 2018 16:31:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5E92820844 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388493AbeGXRiq (ORCPT ); Tue, 24 Jul 2018 13:38:46 -0400 Received: from mailout.easymail.ca ([64.68.200.34]:45563 "EHLO mailout.easymail.ca" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388409AbeGXRiq (ORCPT ); Tue, 24 Jul 2018 13:38:46 -0400 Received: from localhost (localhost [127.0.0.1]) by mailout.easymail.ca (Postfix) with ESMTP id CB075217DD; Tue, 24 Jul 2018 16:31:29 +0000 (UTC) Received: from mailout.easymail.ca ([127.0.0.1]) by localhost (emo02-pco.easydns.vpn [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id pRdQxoJtIQX9; Tue, 24 Jul 2018 16:31:29 +0000 (UTC) Received: from [192.168.1.87] (c-24-9-64-241.hsd1.co.comcast.net [24.9.64.241]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mailout.easymail.ca (Postfix) with ESMTPSA id EA214216AA; Tue, 24 Jul 2018 16:31:21 +0000 (UTC) Subject: Re: [PATCH 18/18] cpupower: change strncpy+truncation to strlcpy To: Dominique Martinet Cc: Thomas Renninger , Colin Ian King , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Shuah Khan References: <1531444483-17338-1-git-send-email-asmadeus@codewreck.org> <1531445169-19912-1-git-send-email-asmadeus@codewreck.org> From: Shuah Khan Message-ID: <2d421d32-ab85-1d4e-0aaf-7f221e0110b0@kernel.org> Date: Tue, 24 Jul 2018 10:31:15 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <1531445169-19912-1-git-send-email-asmadeus@codewreck.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 07/12/2018 07:26 PM, Dominique Martinet wrote: > 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) { > Thanks for the patch. I will pull this in for 4.19-rc1 -- Shuah