diff mbox

[2/2] qemu-img: Avoid setting ret to unused value in img_convert()

Message ID 1486744104-15590-3-git-send-email-peter.maydell@linaro.org
State New
Headers show

Commit Message

Peter Maydell Feb. 10, 2017, 4:28 p.m. UTC
Coverity points out that we assign the return value from
bdrv_snapshot_load_tmp() to 'ret' in img_convert(), but then
never use that variable. (We check for failure by looking
at local_err instead.) Drop the unused assignment, bringing
the call into line with the following call to
bdrv_snapshot_laod_tmp_by_id_or_name().

(Fixes CID 1247240.)

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 qemu-img.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Philippe Mathieu-Daudé Feb. 11, 2017, 3:57 a.m. UTC | #1
On 02/10/2017 01:28 PM, Peter Maydell wrote:
> Coverity points out that we assign the return value from
> bdrv_snapshot_load_tmp() to 'ret' in img_convert(), but then
> never use that variable. (We check for failure by looking
> at local_err instead.) Drop the unused assignment, bringing
> the call into line with the following call to
> bdrv_snapshot_laod_tmp_by_id_or_name().
>
> (Fixes CID 1247240.)
>
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

> ---
>  qemu-img.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/qemu-img.c b/qemu-img.c
> index aa71588..9227d3a 100644
> --- a/qemu-img.c
> +++ b/qemu-img.c
> @@ -1966,10 +1966,10 @@ static int img_convert(int argc, char **argv)
>      }
>
>      if (sn_opts) {
> -        ret = bdrv_snapshot_load_tmp(bs[0],
> -                                     qemu_opt_get(sn_opts, SNAPSHOT_OPT_ID),
> -                                     qemu_opt_get(sn_opts, SNAPSHOT_OPT_NAME),
> -                                     &local_err);
> +        bdrv_snapshot_load_tmp(bs[0],
> +                               qemu_opt_get(sn_opts, SNAPSHOT_OPT_ID),
> +                               qemu_opt_get(sn_opts, SNAPSHOT_OPT_NAME),
> +                               &local_err);
>      } else if (snapshot_name != NULL) {
>          if (bs_n > 1) {
>              error_report("No support for concatenating multiple snapshot");
>
diff mbox

Patch

diff --git a/qemu-img.c b/qemu-img.c
index aa71588..9227d3a 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -1966,10 +1966,10 @@  static int img_convert(int argc, char **argv)
     }
 
     if (sn_opts) {
-        ret = bdrv_snapshot_load_tmp(bs[0],
-                                     qemu_opt_get(sn_opts, SNAPSHOT_OPT_ID),
-                                     qemu_opt_get(sn_opts, SNAPSHOT_OPT_NAME),
-                                     &local_err);
+        bdrv_snapshot_load_tmp(bs[0],
+                               qemu_opt_get(sn_opts, SNAPSHOT_OPT_ID),
+                               qemu_opt_get(sn_opts, SNAPSHOT_OPT_NAME),
+                               &local_err);
     } else if (snapshot_name != NULL) {
         if (bs_n > 1) {
             error_report("No support for concatenating multiple snapshot");