All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] xl/libxl: fixes for vsnd
@ 2018-07-10 13:46 Wei Liu
  2018-07-10 13:46 ` [PATCH 1/3] libxl/vsnd: add missing error checks Wei Liu
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Wei Liu @ 2018-07-10 13:46 UTC (permalink / raw)
  To: Xen-devel; +Cc: Wei Liu, al1img, Ian Jackson

Wei Liu (3):
  libxl/vsnd: add missing error checks
  xl/vsnd: use xcalloc to allocate memory for parser
  xl/vsnd: initialise rc in dryrun path

 tools/libxl/libxl_vsnd.c |  2 ++
 tools/xl/xl_parse.c      | 12 ++++++------
 tools/xl/xl_vsnd.c       |  1 +
 3 files changed, 9 insertions(+), 6 deletions(-)

-- 
2.11.0


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/3] libxl/vsnd: add missing error checks
  2018-07-10 13:46 [PATCH 0/3] xl/libxl: fixes for vsnd Wei Liu
@ 2018-07-10 13:46 ` Wei Liu
  2018-07-10 13:46 ` [PATCH 2/3] xl/vsnd: use xcalloc to allocate memory for parser Wei Liu
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Wei Liu @ 2018-07-10 13:46 UTC (permalink / raw)
  To: Xen-devel; +Cc: Wei Liu, al1img, Ian Jackson

Reported-by: Coverity
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
---
 tools/libxl/libxl_vsnd.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/libxl/libxl_vsnd.c b/tools/libxl/libxl_vsnd.c
index cf46e3ddb1..9570a4cf0e 100644
--- a/tools/libxl/libxl_vsnd.c
+++ b/tools/libxl/libxl_vsnd.c
@@ -192,6 +192,7 @@ static int libxl__pcm_from_xenstore(libxl__gc *gc, const char *path,
                         GCSPRINTF("%s/"XENSND_FIELD_DEVICE_NAME, path), NULL);
 
     rc = libxl__params_from_xenstore(gc, path, &pcm->params);
+    if (rc) goto out;
 
     pcm->streams = NULL;
     pcm->num_vsnd_streams = 0;
@@ -253,6 +254,7 @@ static int libxl__vsnd_from_xenstore(libxl__gc *gc, const char *libxl_path,
                               fe_path), NULL);
 
     rc = libxl__params_from_xenstore(gc, fe_path, &vsnd->params);
+    if (rc) goto out;
 
     vsnd->pcms = NULL;
     vsnd->num_vsnd_pcms = 0;
-- 
2.11.0


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/3] xl/vsnd: use xcalloc to allocate memory for parser
  2018-07-10 13:46 [PATCH 0/3] xl/libxl: fixes for vsnd Wei Liu
  2018-07-10 13:46 ` [PATCH 1/3] libxl/vsnd: add missing error checks Wei Liu
@ 2018-07-10 13:46 ` Wei Liu
  2018-07-10 13:46 ` [PATCH 3/3] xl/vsnd: initialise rc in dryrun path Wei Liu
  2018-07-10 13:52 ` [PATCH 0/3] xl/libxl: fixes for vsnd Ian Jackson
  3 siblings, 0 replies; 5+ messages in thread
From: Wei Liu @ 2018-07-10 13:46 UTC (permalink / raw)
  To: Xen-devel; +Cc: Wei Liu, al1img, Ian Jackson

... because it handles errors for us.

Reported-by: Coverity
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
---
 tools/xl/xl_parse.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/tools/xl/xl_parse.c b/tools/xl/xl_parse.c
index 3ebf6d9023..f9147f6a5c 100644
--- a/tools/xl/xl_parse.c
+++ b/tools/xl/xl_parse.c
@@ -820,8 +820,8 @@ int parse_vdispl_config(libxl_device_vdispl *vdispl, char *token)
         split_string_into_string_list(oparg, ";", &connectors);
 
         vdispl->num_connectors = libxl_string_list_length(&connectors);
-        vdispl->connectors = calloc(vdispl->num_connectors,
-                                    sizeof(*vdispl->connectors));
+        vdispl->connectors = xcalloc(vdispl->num_connectors,
+                                     sizeof(*vdispl->connectors));
 
         for(i = 0; i < vdispl->num_connectors; i++)
         {
@@ -863,8 +863,8 @@ static int parse_vsnd_params(libxl_vsnd_params *params, char *token)
         split_string_into_string_list(oparg, ";", &rates);
 
         params->num_sample_rates = libxl_string_list_length(&rates);
-        params->sample_rates = calloc(params->num_sample_rates,
-                                      sizeof(*params->sample_rates));
+        params->sample_rates = xcalloc(params->num_sample_rates,
+                                       sizeof(*params->sample_rates));
 
         for (i = 0; i < params->num_sample_rates; i++) {
             params->sample_rates[i] = strtoul(rates[i], NULL, 0);
@@ -877,8 +877,8 @@ static int parse_vsnd_params(libxl_vsnd_params *params, char *token)
         split_string_into_string_list(oparg, ";", &formats);
 
         params->num_sample_formats = libxl_string_list_length(&formats);
-        params->sample_formats = calloc(params->num_sample_formats,
-                                        sizeof(*params->sample_formats));
+        params->sample_formats = xcalloc(params->num_sample_formats,
+                                         sizeof(*params->sample_formats));
 
         for (i = 0; i < params->num_sample_formats; i++) {
             libxl_vsnd_pcm_format format;
-- 
2.11.0


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 3/3] xl/vsnd: initialise rc in dryrun path
  2018-07-10 13:46 [PATCH 0/3] xl/libxl: fixes for vsnd Wei Liu
  2018-07-10 13:46 ` [PATCH 1/3] libxl/vsnd: add missing error checks Wei Liu
  2018-07-10 13:46 ` [PATCH 2/3] xl/vsnd: use xcalloc to allocate memory for parser Wei Liu
@ 2018-07-10 13:46 ` Wei Liu
  2018-07-10 13:52 ` [PATCH 0/3] xl/libxl: fixes for vsnd Ian Jackson
  3 siblings, 0 replies; 5+ messages in thread
From: Wei Liu @ 2018-07-10 13:46 UTC (permalink / raw)
  To: Xen-devel; +Cc: Wei Liu, al1img, Ian Jackson

Reported-by: Coverity
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
---
 tools/xl/xl_vsnd.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/xl/xl_vsnd.c b/tools/xl/xl_vsnd.c
index 6dd3a901b2..3306b93139 100644
--- a/tools/xl/xl_vsnd.c
+++ b/tools/xl/xl_vsnd.c
@@ -46,6 +46,7 @@ int main_vsndattach(int argc, char **argv)
     if (dryrun_only) {
         char *json = libxl_device_vsnd_to_json(ctx, &vsnd);
         printf("vsnd: %s\n", json);
+        rc = 0;
         free(json);
         goto out;
     }
-- 
2.11.0


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 0/3] xl/libxl: fixes for vsnd
  2018-07-10 13:46 [PATCH 0/3] xl/libxl: fixes for vsnd Wei Liu
                   ` (2 preceding siblings ...)
  2018-07-10 13:46 ` [PATCH 3/3] xl/vsnd: initialise rc in dryrun path Wei Liu
@ 2018-07-10 13:52 ` Ian Jackson
  3 siblings, 0 replies; 5+ messages in thread
From: Ian Jackson @ 2018-07-10 13:52 UTC (permalink / raw)
  To: Wei Liu; +Cc: Xen-devel, al1img

Wei Liu writes ("[PATCH 0/3] xl/libxl: fixes for vsnd "):
> Wei Liu (3):
>   libxl/vsnd: add missing error checks
>   xl/vsnd: use xcalloc to allocate memory for parser
>   xl/vsnd: initialise rc in dryrun path

All three,

Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-07-10 13:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-10 13:46 [PATCH 0/3] xl/libxl: fixes for vsnd Wei Liu
2018-07-10 13:46 ` [PATCH 1/3] libxl/vsnd: add missing error checks Wei Liu
2018-07-10 13:46 ` [PATCH 2/3] xl/vsnd: use xcalloc to allocate memory for parser Wei Liu
2018-07-10 13:46 ` [PATCH 3/3] xl/vsnd: initialise rc in dryrun path Wei Liu
2018-07-10 13:52 ` [PATCH 0/3] xl/libxl: fixes for vsnd Ian Jackson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.