提交 a316b5ca 编写于 作者: D Dmitry Osipenko 提交者: Chanwoo Choi

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: NDmitry Osipenko <digetx@gmail.com>
Signed-off-by: NChanwoo Choi <cw00.choi@samsung.com>
上级 02355216
...@@ -768,7 +768,7 @@ struct devfreq *devfreq_add_device(struct device *dev, ...@@ -768,7 +768,7 @@ struct devfreq *devfreq_add_device(struct device *dev,
devfreq->dev.release = devfreq_dev_release; devfreq->dev.release = devfreq_dev_release;
INIT_LIST_HEAD(&devfreq->node); INIT_LIST_HEAD(&devfreq->node);
devfreq->profile = profile; 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->previous_freq = profile->initial_freq;
devfreq->last_status.current_frequency = profile->initial_freq; devfreq->last_status.current_frequency = profile->initial_freq;
devfreq->data = data; devfreq->data = data;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册