lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <09712864-01a5-e2f9-b55f-e822169d30fc@gmail.com>
Date:   Fri, 17 Apr 2020 17:04:54 +0300
From:   Dmitry Osipenko <digetx@...il.com>
To:     MyungJoo Ham <myungjoo.ham@...sung.com>,
        Kyungmin Park <kyungmin.park@...sung.com>,
        Chanwoo Choi <cw00.choi@...sung.com>
Cc:     linux-pm@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH RE-SEND v1] PM / devfreq: Replace strncpy with strscpy

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@...il.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?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ