]> xenbits.xensource.com Git - xen.git/commitdiff
rangeset: no need to use snprintf()
authorJan Beulich <jbeulich@suse.com>
Tue, 6 Apr 2021 14:18:41 +0000 (16:18 +0200)
committerJan Beulich <jbeulich@suse.com>
Tue, 6 Apr 2021 14:18:41 +0000 (16:18 +0200)
As of the conversion to safe_strcpy() years ago there has been no need
anymore to use snprintf() to prevent storing a not-nul-terminated string.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Julien Grall <jgrall@amazon.com>
xen/common/rangeset.c

index 4ebba30ba3037e80c9abffe0d163e8371b2866ec..0afe638f40b751ca4677924df74b2e0cca405242 100644 (file)
@@ -436,14 +436,7 @@ struct rangeset *rangeset_new(
     BUG_ON(flags & ~RANGESETF_prettyprint_hex);
     r->flags = flags;
 
-    if ( name != NULL )
-    {
-        safe_strcpy(r->name, name);
-    }
-    else
-    {
-        snprintf(r->name, sizeof(r->name), "(no name)");
-    }
+    safe_strcpy(r->name, name ?: "(no name)");
 
     if ( (r->domain = d) != NULL )
     {