[PATCH] net: Do not include a newline in the id of -nic devices

Thomas Huth posted 1 patch 5 years, 6 months ago
Test docker-mingw@fedora passed
Test checkpatch passed
Test asan passed
Test docker-quick@centos7 passed
Test FreeBSD passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20200518074352.23125-1-thuth@redhat.com
Maintainers: Jason Wang <jasowang@redhat.com>
net/net.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] net: Do not include a newline in the id of -nic devices
Posted by Thomas Huth 5 years, 6 months ago
The '\n' sneaked in by accident here, an "id" string should really
not contain a newline character at the end.

Fixes: 78cd6f7bf6b ('net: Add a new convenience option "--nic" ...')
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 net/net.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/net.c b/net/net.c
index 38778e831d..cbeeeadff8 100644
--- a/net/net.c
+++ b/net/net.c
@@ -1506,7 +1506,7 @@ static int net_param_nic(void *dummy, QemuOpts *opts, Error **errp)
     /* Create an ID if the user did not specify one */
     nd_id = g_strdup(qemu_opts_id(opts));
     if (!nd_id) {
-        nd_id = g_strdup_printf("__org.qemu.nic%i\n", idx);
+        nd_id = g_strdup_printf("__org.qemu.nic%i", idx);
         qemu_opts_set_id(opts, nd_id);
     }
 
-- 
2.18.1


Re: [PATCH] net: Do not include a newline in the id of -nic devices
Posted by Philippe Mathieu-Daudé 5 years, 6 months ago
On 5/18/20 9:43 AM, Thomas Huth wrote:
> The '\n' sneaked in by accident here, an "id" string should really
> not contain a newline character at the end.
> 
> Fixes: 78cd6f7bf6b ('net: Add a new convenience option "--nic" ...')
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
>   net/net.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/net.c b/net/net.c
> index 38778e831d..cbeeeadff8 100644
> --- a/net/net.c
> +++ b/net/net.c
> @@ -1506,7 +1506,7 @@ static int net_param_nic(void *dummy, QemuOpts *opts, Error **errp)
>       /* Create an ID if the user did not specify one */
>       nd_id = g_strdup(qemu_opts_id(opts));
>       if (!nd_id) {
> -        nd_id = g_strdup_printf("__org.qemu.nic%i\n", idx);
> +        nd_id = g_strdup_printf("__org.qemu.nic%i", idx);
>           qemu_opts_set_id(opts, nd_id);
>       }
>   
> 

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>


Re: [PATCH] net: Do not include a newline in the id of -nic devices
Posted by Philippe Mathieu-Daudé 5 years, 5 months ago
On 5/18/20 9:43 AM, Thomas Huth wrote:
> The '\n' sneaked in by accident here, an "id" string should really
> not contain a newline character at the end.
> 
> Fixes: 78cd6f7bf6b ('net: Add a new convenience option "--nic" ...')
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
>  net/net.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/net.c b/net/net.c
> index 38778e831d..cbeeeadff8 100644
> --- a/net/net.c
> +++ b/net/net.c
> @@ -1506,7 +1506,7 @@ static int net_param_nic(void *dummy, QemuOpts *opts, Error **errp)
>      /* Create an ID if the user did not specify one */
>      nd_id = g_strdup(qemu_opts_id(opts));
>      if (!nd_id) {
> -        nd_id = g_strdup_printf("__org.qemu.nic%i\n", idx);
> +        nd_id = g_strdup_printf("__org.qemu.nic%i", idx);
>          qemu_opts_set_id(opts, nd_id);
>      }
>  
> 

ping?


Re: [PATCH] net: Do not include a newline in the id of -nic devices
Posted by Laurent Vivier 5 years, 5 months ago
Le 18/05/2020 à 09:43, Thomas Huth a écrit :
> The '\n' sneaked in by accident here, an "id" string should really
> not contain a newline character at the end.
> 
> Fixes: 78cd6f7bf6b ('net: Add a new convenience option "--nic" ...')
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
>  net/net.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/net.c b/net/net.c
> index 38778e831d..cbeeeadff8 100644
> --- a/net/net.c
> +++ b/net/net.c
> @@ -1506,7 +1506,7 @@ static int net_param_nic(void *dummy, QemuOpts *opts, Error **errp)
>      /* Create an ID if the user did not specify one */
>      nd_id = g_strdup(qemu_opts_id(opts));
>      if (!nd_id) {
> -        nd_id = g_strdup_printf("__org.qemu.nic%i\n", idx);
> +        nd_id = g_strdup_printf("__org.qemu.nic%i", idx);
>          qemu_opts_set_id(opts, nd_id);
>      }
>  
> 


Applied to my trivial-patches branch.

Thanks,
Laurent