diff mbox

[v3,for-4.7,07/16] libxc: fix usage of uninitialized variable

Message ID 1461755514-23754-8-git-send-email-roger.pau@citrix.com (mailing list archive)
State New, archived
Headers show

Commit Message

Roger Pau Monné April 27, 2016, 11:11 a.m. UTC
*size should be used instead, because it contains the size of the buffer in
out_buf.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
---
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Wei Liu <wei.liu2@citrix.com>
---
Changes since v2:
 - Use *size instead of 0, because it will contain the actual size of the
   out_buf buffer.
---
 tools/libxc/xc_dom_bzimageloader.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Wei Liu April 27, 2016, 11:22 a.m. UTC | #1
On Wed, Apr 27, 2016 at 01:11:45PM +0200, Roger Pau Monne wrote:
> *size should be used instead, because it contains the size of the buffer in
> out_buf.
> 
> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>

Acked-by: Wei Liu <wei.liu2@citrix.com>
Wei Liu April 27, 2016, 1:18 p.m. UTC | #2
On Wed, Apr 27, 2016 at 01:11:45PM +0200, Roger Pau Monne wrote:
> *size should be used instead, because it contains the size of the buffer in
> out_buf.
> 
> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
> ---
> Cc: Ian Jackson <ian.jackson@eu.citrix.com>
> Cc: Wei Liu <wei.liu2@citrix.com>
> ---
> Changes since v2:
>  - Use *size instead of 0, because it will contain the actual size of the
>    out_buf buffer.

Ian, this is a backport candidate.

Note that the code still functions without this fix because the third
parameter to xc_dom_register_external is only for accounting purpose.

Wei.

> ---
>  tools/libxc/xc_dom_bzimageloader.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/libxc/xc_dom_bzimageloader.c b/tools/libxc/xc_dom_bzimageloader.c
> index 7fde42a..33ba06b 100644
> --- a/tools/libxc/xc_dom_bzimageloader.c
> +++ b/tools/libxc/xc_dom_bzimageloader.c
> @@ -482,7 +482,7 @@ static int xc_try_lzo1x_decode(
>          if ( !dst_len )
>          {
>              msg = "Error registering stream output";
> -            if ( xc_dom_register_external(dom, out_buf, out_len) )
> +            if ( xc_dom_register_external(dom, out_buf, *size) )
>                  break;
>  
>              return 0;
> -- 
> 2.6.4 (Apple Git-63)
>
Ian Jackson April 28, 2016, 5:43 p.m. UTC | #3
Wei Liu writes ("Re: [PATCH v3 for-4.7 07/16] libxc: fix usage of uninitialized variable"):
> Ian, this is a backport candidate.

Noted, thanks.

Ian.
Ian Jackson May 9, 2016, 5:10 p.m. UTC | #4
Ian Jackson writes ("Re: [PATCH v3 for-4.7 07/16] libxc: fix usage of uninitialized variable"):
> Wei Liu writes ("Re: [PATCH v3 for-4.7 07/16] libxc: fix usage of uninitialized variable"):
> > Ian, this is a backport candidate.
> 
> Noted, thanks.

Backported to 4.6 and 4.5.

Ian.
diff mbox

Patch

diff --git a/tools/libxc/xc_dom_bzimageloader.c b/tools/libxc/xc_dom_bzimageloader.c
index 7fde42a..33ba06b 100644
--- a/tools/libxc/xc_dom_bzimageloader.c
+++ b/tools/libxc/xc_dom_bzimageloader.c
@@ -482,7 +482,7 @@  static int xc_try_lzo1x_decode(
         if ( !dst_len )
         {
             msg = "Error registering stream output";
-            if ( xc_dom_register_external(dom, out_buf, out_len) )
+            if ( xc_dom_register_external(dom, out_buf, *size) )
                 break;
 
             return 0;