<div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-size:small"><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Jul 26, 2022 at 11:56 PM Petr Vorel <<a href="mailto:pvorel@suse.cz">pvorel@suse.cz</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Add space for null terminator to fix warning:<br>
<br>
tst_cgroup.c:505:17: warning: ‘__builtin_strncpy’ output may be truncated copying 255 bytes from a string of length 255 [-Wstringop-truncation]<br>
505 | strncpy(cgroup_test_dir, test_dir_name, NAME_MAX);<br>
| ^<br>
<br>
Fixes: ebebdd735 ("API/cgroup: Implement tst_cg_load_config")<br>
<br>
Signed-off-by: Petr Vorel <<a href="mailto:pvorel@suse.cz" target="_blank">pvorel@suse.cz</a>><br></blockquote><div> </div><div><span class="gmail_default" style="font-size:small"></span>Reviewed-by: Li Wang <<a href="mailto:liwang@redhat.com" target="_blank">liwang@redhat.com</a>></div><div><span class="gmail_default"><br></span></div><div><span class="gmail_default"></span> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
---<br>
lib/tst_cgroup.c | 2 +-<br>
1 file changed, 1 insertion(+), 1 deletion(-)<br>
<br>
diff --git a/lib/tst_cgroup.c b/lib/tst_cgroup.c<br>
index 998b259a6..6f24e0450 100644<br>
--- a/lib/tst_cgroup.c<br>
+++ b/lib/tst_cgroup.c<br>
@@ -502,7 +502,7 @@ static void cgroup_parse_config_line(const char *const config_entry)<br>
}<br>
<br>
if (!root->test_dir.dir_name && strcmp(test_dir_name, "NULL")) {<br>
- strncpy(cgroup_test_dir, test_dir_name, NAME_MAX);<br>
+ strncpy(cgroup_test_dir, test_dir_name, NAME_MAX + 1);<br>
cgroup_dir_mk(&root->ltp_dir, cgroup_test_dir, &root->test_dir);<br>
root->test_dir.we_created_it = 1;<br>
}<br>
-- <br>
2.37.1<br>
<br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div>Regards,<br></div><div>Li Wang<br></div></div></div></div>