[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[xen staging] rangeset: no need to use snprintf()



commit 6425fcf37122b1f1e4ceaacadd00a4c280a58f57
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Tue Apr 6 16:18:41 2021 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Tue Apr 6 16:18:41 2021 +0200

    rangeset: no need to use snprintf()
    
    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@xxxxxxxx>
    Acked-by: Julien Grall <jgrall@xxxxxxxxxx>
---
 xen/common/rangeset.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/xen/common/rangeset.c b/xen/common/rangeset.c
index 4ebba30ba3..0afe638f40 100644
--- a/xen/common/rangeset.c
+++ b/xen/common/rangeset.c
@@ -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 )
     {
--
generated by git-patchbot for /home/xen/git/xen.git#staging



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.