All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hitoshi Mitake <mitake.hitoshi@gmail.com>
To: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Paul Mackerras <paulus@samba.org>, Ingo Molnar <mingo@redhat.com>,
	Arnaldo Carvalho de Melo <acme@ghostprotocols.net>,
	Hitoshi Mitake <h.mitake@gmail.com>,
	linux-kernel@vger.kernel.org, mitake.hitoshi@gmail.com
Subject: Re: [PATCH] perf bench: fix memory allocation fail check in mem{set,cpy} workloads
Date: Thu, 06 Jun 2013 23:06:04 +0900	[thread overview]
Message-ID: <87vc5re3lf.wl%mitake.hitoshi@gmail.com> (raw)
In-Reply-To: <1370518503-4230-1-git-send-email-kirill.shutemov@linux.intel.com>


Hi Kirill,

At Thu,  6 Jun 2013 14:35:03 +0300,
Kirill A. Shutemov wrote:
> 
> From: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
> 
> Addresses of allocated memory areas saved to '*src' and '*dst', so we
> need to check them for NULL, not 'src' and 'dst'.

Thanks for your fix, this is my mistake.
Acked-by: Hitoshi Mitake <mitake.hitoshi@lab.ntt.co.jp>

> 
> Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
> ---
>  tools/perf/bench/mem-memcpy.c |    4 ++--
>  tools/perf/bench/mem-memset.c |    2 +-
>  2 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/tools/perf/bench/mem-memcpy.c b/tools/perf/bench/mem-memcpy.c
> index 93c83e3..25fd3f1 100644
> --- a/tools/perf/bench/mem-memcpy.c
> +++ b/tools/perf/bench/mem-memcpy.c
> @@ -111,11 +111,11 @@ static double timeval2double(struct timeval *ts)
>  static void alloc_mem(void **dst, void **src, size_t length)
>  {
>  	*dst = zalloc(length);
> -	if (!dst)
> +	if (!*dst)
>  		die("memory allocation failed - maybe length is too large?\n");
>  
>  	*src = zalloc(length);
> -	if (!src)
> +	if (!*src)
>  		die("memory allocation failed - maybe length is too large?\n");
>  }
>  
> diff --git a/tools/perf/bench/mem-memset.c b/tools/perf/bench/mem-memset.c
> index c6e4bc5..4a2f120 100644
> --- a/tools/perf/bench/mem-memset.c
> +++ b/tools/perf/bench/mem-memset.c
> @@ -111,7 +111,7 @@ static double timeval2double(struct timeval *ts)
>  static void alloc_mem(void **dst, size_t length)
>  {
>  	*dst = zalloc(length);
> -	if (!dst)
> +	if (!*dst)
>  		die("memory allocation failed - maybe length is too large?\n");
>  }
>  
> -- 
> 1.7.10.4
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

  reply	other threads:[~2013-06-06 14:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-06 11:35 [PATCH] perf bench: fix memory allocation fail check in mem{set,cpy} workloads Kirill A. Shutemov
2013-06-06 14:06 ` Hitoshi Mitake [this message]
2013-07-12  8:49 ` [tip:perf/urgent] perf bench: Fix " tip-bot for Kirill A. Shutemov

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=87vc5re3lf.wl%mitake.hitoshi@gmail.com \
    --to=mitake.hitoshi@gmail.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@ghostprotocols.net \
    --cc=h.mitake@gmail.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=paulus@samba.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.