From: Dmitry Osipenko <digetx@gmail.com>
To: MyungJoo Ham <myungjoo.ham@samsung.com>,
Kyungmin Park <kyungmin.park@samsung.com>,
Chanwoo Choi <cw00.choi@samsung.com>
Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH RE-SEND v1] PM / devfreq: Replace strncpy with strscpy
Date: Fri, 17 Apr 2020 17:04:54 +0300 [thread overview]
Message-ID: <09712864-01a5-e2f9-b55f-e822169d30fc@gmail.com> (raw)
In-Reply-To: <20200227170854.9949-1-digetx@gmail.com>
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 <digetx@gmail.com>
> ---
> 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?
next prev parent reply other threads:[~2020-04-17 14:05 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-27 17:08 [PATCH RE-SEND v1] PM / devfreq: Replace strncpy with strscpy Dmitry Osipenko
2020-04-17 14:04 ` Dmitry Osipenko [this message]
2020-05-07 0:02 ` Chanwoo Choi
2020-05-07 1:00 ` Dmitry Osipenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=09712864-01a5-e2f9-b55f-e822169d30fc@gmail.com \
--to=digetx@gmail.com \
--cc=cw00.choi@samsung.com \
--cc=kyungmin.park@samsung.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=myungjoo.ham@samsung.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox