All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wei Liu <wei.liu2@citrix.com>
To: PRAMOD DEVENDRA <pramod.devendra@citrix.com>
Cc: xen-devel@lists.xenproject.org, Wei Liu <wei.liu2@citrix.com>,
	Ian Jackson <ian.jackson@eu.citrix.com>,
	Ian Campbell <ian.campbell@citrix.com>,
	Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Subject: Re: [PATCH 2/3] tools/libxl/libxl_cpuid.c: Fix leak of resstr on error path
Date: Tue, 17 Mar 2015 15:44:16 +0000	[thread overview]
Message-ID: <20150317154416.GC20522@zion.uk.xensource.com> (raw)
In-Reply-To: <1426500377-40643-1-git-send-email-pramod.devendra@citrix.com>

On Mon, Mar 16, 2015 at 10:06:17AM +0000, PRAMOD DEVENDRA wrote:
> From: Pramod Devendra <pramod.devendra@citrix.com>
> 
> Signed-off-by: Pramod Devendra <pramod.devendra@citrix.com>
> CC: Ian Jackson <ian.jackson@eu.citrix.com>
> CC: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
> CC: Ian Campbell <ian.campbell@citrix.com>
> CC: Wei Liu <wei.liu2@citrix.com>

Acked-by: Wei Liu <wei.liu2@citrix.com>

> ---
>  tools/libxl/libxl_cpuid.c |    8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/tools/libxl/libxl_cpuid.c b/tools/libxl/libxl_cpuid.c
> index b0bdc9d..c66e912 100644
> --- a/tools/libxl/libxl_cpuid.c
> +++ b/tools/libxl/libxl_cpuid.c
> @@ -223,9 +223,6 @@ int libxl_cpuid_parse_config(libxl_cpuid_policy_list *cpuid, const char* str)
>      }
>      entry = cpuid_find_match(cpuid, flag->leaf, flag->subleaf);
>      resstr = entry->policy[flag->reg - 1];
> -    if (resstr == NULL) {
> -        resstr = strdup("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
> -    }

Minor nit. I would prefer "resstr = " be grouped with the code you
moved. No need to resend though.

Wei.

>      num = strtoull(val, &endptr, 0);
>      flags[flag->length] = 0;
>      if (endptr != val) {
> @@ -242,6 +239,11 @@ int libxl_cpuid_parse_config(libxl_cpuid_policy_list *cpuid, const char* str)
>              return 3;
>          }
>      }
> +
> +    if (resstr == NULL) {
> +        resstr = strdup("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
> +    }
> +
>      /* the family and model entry is potentially split up across
>       * two fields in Fn0000_0001_EAX, so handle them here separately.
>       */
> -- 
> 1.7.10.4

  reply	other threads:[~2015-03-17 15:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-16 10:06 [PATCH 2/3] tools/libxl/libxl_cpuid.c: Fix leak of resstr on error path PRAMOD DEVENDRA
2015-03-17 15:44 ` Wei Liu [this message]
2015-03-18 12:31   ` Ian Campbell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150317154416.GC20522@zion.uk.xensource.com \
    --to=wei.liu2@citrix.com \
    --cc=ian.campbell@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=pramod.devendra@citrix.com \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.