Clang warns:
../drivers/soc/qcom/glink_debugfs.c:562:18: warning: size argument in
'strlcpy' call appears to be size of the source; expected the size of
the destination [-Wstrlcpy-strlcat-size]
curr, strlen(curr) + 1);
~~~~~~~^~~~~~~~~
../drivers/soc/qcom/glink_debugfs.c:562:11: note: change size argument
to be the size of the destination
curr, strlen(curr) + 1);
^~~~~~~~~~~~~~~~
sizeof(dbgfs_dent_s->self_name)
../drivers/soc/qcom/glink_debugfs.c:564:13: warning: size argument in
'strlcpy' call appears to be size of the source; expected the size of
the destination [-Wstrlcpy-strlcat-size]
strlen(par_dir) + 1);
~~~~~~~^~~~~~~~~~~~
../drivers/soc/qcom/glink_debugfs.c:564:6: note: change size argument to
be the size of the destination
strlen(par_dir) + 1);
^~~~~~~~~~~~~~~~~~~
sizeof(dbgfs_dent_s->par_name)
2 warnings generated.
Fixes:
987bbebd9aa6 ("soc: qcom: Add snapshot of G-Link driver")
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
spin_lock_init(&dbgfs_dent_s->file_list_lock_lhb0);
dbgfs_dent_s->parent = parent;
dbgfs_dent_s->self = curr_dent;
- strlcpy(dbgfs_dent_s->self_name,
- curr, strlen(curr) + 1);
- strlcpy(dbgfs_dent_s->par_name, par_dir,
- strlen(par_dir) + 1);
+ strscpy(dbgfs_dent_s->self_name, curr,
+ sizeof(dbgfs_dent_s->self_name));
+ strscpy(dbgfs_dent_s->par_name, par_dir,
+ sizeof(dbgfs_dent_s->par_name));
mutex_lock(&dent_list_lock_lha0);
list_add_tail(&dbgfs_dent_s->list_node, &dent_list);
mutex_unlock(&dent_list_lock_lha0);