Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp298330ybj; Wed, 6 May 2020 18:04:49 -0700 (PDT) X-Google-Smtp-Source: APiQypIxP0pk6RaGV4XORyLp00rugNjsFBdsViCzQu3hnwlUeezTnuXyFoA3fNO8MmBzChZRGcd0 X-Received: by 2002:a17:906:340a:: with SMTP id c10mr10110511ejb.218.1588813489046; Wed, 06 May 2020 18:04:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588813489; cv=none; d=google.com; s=arc-20160816; b=wE0lo4pBjpBKa85ahNoWCEb7a8BWKlRGcGizUo9qMhLw3y+kUuzO4T45V0JFe35qz0 75fLLdLggb/dGuNIzovmW/8mBjzqcMoF5Kw4ecisKV0L/vDb/zHl3AS/2k0Rwr3tvnUc hxY1kS6RDs81lZwJbSCh3jRXdcCIjevSxqpJWcQxZlKS/IpaIR6eaAbffZj7Uot3CAKC OImrSoMfaj7JELhlIABlWQyhmFHhiIaXJh2QcQGU7GCjpY+dKc4t7Bm0z24liJJm+bPY ISAOCXQS/gGFHHGmtJ1K9lDCdP29Es4hibk+izxEny3V18gB9rOqhaK5KES7kqEl6RHd mXpA== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=x/pZlFx1RwiUZJoCBeew19ILHCP9+NjHgoBLA53ee50=; b=Sp0f3t4lD0HOlMQRMTDNLHJhsR7MUBO1mTkMVJ0z+B9amne/T/EbOSk0pM0QtIQYo5 0ytp5OkcsbEcLEw/+gL/sNe3Jq82aWaCg3hGN8UeyitNIo434q+ksSm6RbKbgV6XcdQe v0xn1lsdqHibxXnEajhVBGo1Gh8bAgxW6Z7i4KB9gpWbmk/ocgRpa01sjejMl1f4/mly 0gh9hRBxlDPa9OIhjkC+XndG5I/LDqYtdy4zgNj3YQ1Wgnt8wDBzuDwD1Rzyr2CNN+8S kx7mirwNAiB2EMYduyJj31gsRuQ26njU2aVB+yblE0YYjm3d77kIoo7AMdIYjEUEAttO CRGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=RF5u0D9b; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a25si2374913ejt.348.2020.05.06.18.04.26; Wed, 06 May 2020 18:04:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=RF5u0D9b; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728467AbgEGBA0 (ORCPT + 99 others); Wed, 6 May 2020 21:00:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36108 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727929AbgEGBA0 (ORCPT ); Wed, 6 May 2020 21:00:26 -0400 Received: from mail-lf1-x142.google.com (mail-lf1-x142.google.com [IPv6:2a00:1450:4864:20::142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0C198C061A0F; Wed, 6 May 2020 18:00:26 -0700 (PDT) Received: by mail-lf1-x142.google.com with SMTP id h26so2986630lfg.6; Wed, 06 May 2020 18:00:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=x/pZlFx1RwiUZJoCBeew19ILHCP9+NjHgoBLA53ee50=; b=RF5u0D9bm1d9Lcf9cSby+XZ8opBSg/msSDr4EVmmJrI/xH8FWeWHoBpoGXaO82LAqv Y9JXHttF/5uWtCrvohiqWxX/WyuOwHxnNp2Uz0TF6djsp1KobJmXNB1H+4hR8hRQVWV8 oM91RdaofZA2D4im2+2y+PVuM+MK7LfVARlZtnP8de27BBUdQrV71xklp2XxIM7lEF6U 9ckQtqgQdXLUd42FoBqdWEW67Z1FNq32TQJozxZUrCpzKD0x4JWPQ6iObv5KpwZ/SQxl XD3V5BbP1IaM9V6BFhvqX2SVlmzjbuQe8ljTXrRh+vRE3LsLDKvftOS+JxXA/MOgKTG6 9NlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=x/pZlFx1RwiUZJoCBeew19ILHCP9+NjHgoBLA53ee50=; b=Sf8WgT//PP5U13iWOVZPExExwcaalDGyyZ4Uu8sfKzvdZcWupKHVBLayy30IMsTDce BzoCIfHZsQZl/ZvNmbq/qmOlxuhGN/YhWsiJZzrrUYZDNikVxHUmLv411KoYFF1jTViF yBVCE973WjtDCVXhaNMa6SDwnxCpeRKNXGTdWkauqeTbez13JhRyv7f82XTSGo30WdCQ ALUlN4p5yQWvzs2VXp9OqQd/D+hX5+ndmnJzhiVpHoGd+irudEgzcFmV+rKO5utG2cOn kzeAW3dHEmiXsIigSBsr+Bhmzw7AF3qEfF4HrsXpkQm5S5F1fypDVqOkmFTthNqY4VTe 3J9A== X-Gm-Message-State: AGi0PuZfwXsFaTI5jL3czjFKSeQlN7ihY7EmKo9UfUBkrrciFWIaeYqy bGMYWWiEUr9h9rx5xVRmNXksKzCo X-Received: by 2002:ac2:5282:: with SMTP id q2mr5720769lfm.100.1588813224087; Wed, 06 May 2020 18:00:24 -0700 (PDT) Received: from [192.168.2.145] (ppp91-78-208-152.pppoe.mtu-net.ru. [91.78.208.152]) by smtp.googlemail.com with ESMTPSA id t13sm2288000ljd.38.2020.05.06.18.00.22 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 06 May 2020 18:00:23 -0700 (PDT) Subject: Re: [PATCH RE-SEND v1] PM / devfreq: Replace strncpy with strscpy To: Chanwoo Choi , MyungJoo Ham , Kyungmin Park Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org References: <20200227170854.9949-1-digetx@gmail.com> <09712864-01a5-e2f9-b55f-e822169d30fc@gmail.com> <41092ded-8bb6-726f-6986-fee62a8a1325@samsung.com> From: Dmitry Osipenko Message-ID: <0cd53502-e876-b26d-5a48-092707395509@gmail.com> Date: Thu, 7 May 2020 04:00:22 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <41092ded-8bb6-726f-6986-fee62a8a1325@samsung.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 07.05.2020 03:02, Chanwoo Choi пишет: > Hi Dmitry, > > On 4/17/20 11:04 PM, Dmitry Osipenko wrote: >> 27.02.2020 20:08, Dmitry Osipenko пишет: >>> GCC produces this warning when kernel compiled using `make W=1`: >>> >>> warning: ‘strncpy’ specified bound 16 equals destination size [-Wstringop-truncation] >>> 772 | strncpy(devfreq->governor_name, governor_name, DEVFREQ_NAME_LEN); >>> >>> The strncpy doesn't take care of NULL-termination of the destination >>> buffer, while the strscpy does. >>> >>> Signed-off-by: Dmitry Osipenko >>> --- >>> drivers/devfreq/devfreq.c | 2 +- >>> 1 file changed, 1 insertion(+), 1 deletion(-) >>> >>> diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c >>> index 8494c5f05a73..2011f64bfa3a 100644 >>> --- a/drivers/devfreq/devfreq.c >>> +++ b/drivers/devfreq/devfreq.c >>> @@ -769,7 +769,7 @@ struct devfreq *devfreq_add_device(struct device *dev, >>> devfreq->dev.release = devfreq_dev_release; >>> INIT_LIST_HEAD(&devfreq->node); >>> devfreq->profile = profile; >>> - strncpy(devfreq->governor_name, governor_name, DEVFREQ_NAME_LEN); >>> + strscpy(devfreq->governor_name, governor_name, DEVFREQ_NAME_LEN); >>> devfreq->previous_freq = profile->initial_freq; >>> devfreq->last_status.current_frequency = profile->initial_freq; >>> devfreq->data = data; >>> >> >> Hello Chanwoo, >> >> Do you have any objections to this patch? >> > > I'm sorry for late reply. I applied it for v5.8-rc1. > Thanks. No problems, thank you :)