[PATCH] contrib/vhost-user-blk: add missing GOptionEntry NULL terminator

Stefan Hajnoczi posted 1 patch 2 years, 1 month ago
Test checkpatch passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20220411150057.3009667-1-stefanha@redhat.com
Maintainers: Raphael Norwitz <raphael.norwitz@nutanix.com>, "Michael S. Tsirkin" <mst@redhat.com>
contrib/vhost-user-blk/vhost-user-blk.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
[PATCH] contrib/vhost-user-blk: add missing GOptionEntry NULL terminator
Posted by Stefan Hajnoczi 2 years, 1 month ago
The GLib documentation says "a NULL-terminated array of GOptionEntrys"
so we'd better make sure there is a terminator that lets
g_option_context_add_main_entries() know when the end of the array has
been reached.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 contrib/vhost-user-blk/vhost-user-blk.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/contrib/vhost-user-blk/vhost-user-blk.c b/contrib/vhost-user-blk/vhost-user-blk.c
index d14b2896bf..cd4a5d7335 100644
--- a/contrib/vhost-user-blk/vhost-user-blk.c
+++ b/contrib/vhost-user-blk/vhost-user-blk.c
@@ -593,7 +593,8 @@ static GOptionEntry entries[] = {
     {"blk-file", 'b', 0, G_OPTION_ARG_FILENAME, &opt_blk_file,
      "block device or file path", "PATH"},
     { "read-only", 'r', 0, G_OPTION_ARG_NONE, &opt_read_only,
-      "Enable read-only", NULL }
+      "Enable read-only", NULL },
+    { NULL, },
 };
 
 int main(int argc, char **argv)
-- 
2.35.1
Re: [PATCH] contrib/vhost-user-blk: add missing GOptionEntry NULL terminator
Posted by Stefan Hajnoczi 2 years, 1 month ago
On Mon, Apr 11, 2022 at 04:00:57PM +0100, Stefan Hajnoczi wrote:
> The GLib documentation says "a NULL-terminated array of GOptionEntrys"
> so we'd better make sure there is a terminator that lets
> g_option_context_add_main_entries() know when the end of the array has
> been reached.
> 
> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
> ---
>  contrib/vhost-user-blk/vhost-user-blk.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

Thanks, applied to my block-next tree:
https://gitlab.com/stefanha/qemu/commits/block-next

Stefan
Re: [PATCH] contrib/vhost-user-blk: add missing GOptionEntry NULL terminator
Posted by Michael S. Tsirkin 2 years, 1 month ago
On Mon, Apr 11, 2022 at 04:00:57PM +0100, Stefan Hajnoczi wrote:
> The GLib documentation says "a NULL-terminated array of GOptionEntrys"
> so we'd better make sure there is a terminator that lets
> g_option_context_add_main_entries() know when the end of the array has
> been reached.
> 
> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>

Reviewed-by: Michael S. Tsirkin <mst@redhat.com>

feel free to merge

> ---
>  contrib/vhost-user-blk/vhost-user-blk.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/contrib/vhost-user-blk/vhost-user-blk.c b/contrib/vhost-user-blk/vhost-user-blk.c
> index d14b2896bf..cd4a5d7335 100644
> --- a/contrib/vhost-user-blk/vhost-user-blk.c
> +++ b/contrib/vhost-user-blk/vhost-user-blk.c
> @@ -593,7 +593,8 @@ static GOptionEntry entries[] = {
>      {"blk-file", 'b', 0, G_OPTION_ARG_FILENAME, &opt_blk_file,
>       "block device or file path", "PATH"},
>      { "read-only", 'r', 0, G_OPTION_ARG_NONE, &opt_read_only,
> -      "Enable read-only", NULL }
> +      "Enable read-only", NULL },
> +    { NULL, },
>  };
>  
>  int main(int argc, char **argv)
> -- 
> 2.35.1