summaryrefslogtreecommitdiffstats
path: root/drivers/devfreq
diff options
context:
space:
mode:
authorDmitry Osipenko <digetx@gmail.com>2020-02-27 18:08:54 +0100
committerChanwoo Choi <cw00.choi@samsung.com>2020-05-28 11:02:39 +0200
commita316b5ca9ead8065ac873e655c313248ecd732bc (patch)
tree12c7e1a06d613c784d8753cc14db7d4c70b10dfd /drivers/devfreq
parentPM / devfreq: imx: Register interconnect device (diff)
downloadlinux-a316b5ca9ead8065ac873e655c313248ecd732bc.tar.xz
linux-a316b5ca9ead8065ac873e655c313248ecd732bc.zip
PM / devfreq: Replace strncpy with strscpy
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> Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Diffstat (limited to 'drivers/devfreq')
-rw-r--r--drivers/devfreq/devfreq.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c
index 6fecd11dafdd..ef3d2bc3d1ac 100644
--- a/drivers/devfreq/devfreq.c
+++ b/drivers/devfreq/devfreq.c
@@ -768,7 +768,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;