Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751908Ab3FFOGP (ORCPT ); Thu, 6 Jun 2013 10:06:15 -0400 Received: from mail-pd0-f177.google.com ([209.85.192.177]:55825 "EHLO mail-pd0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750870Ab3FFOGO (ORCPT ); Thu, 6 Jun 2013 10:06:14 -0400 Date: Thu, 06 Jun 2013 23:06:04 +0900 Message-ID: <87vc5re3lf.wl%mitake.hitoshi@gmail.com> From: Hitoshi Mitake To: "Kirill A. Shutemov" Cc: Peter Zijlstra , Paul Mackerras , Ingo Molnar , Arnaldo Carvalho de Melo , Hitoshi Mitake , linux-kernel@vger.kernel.org, mitake.hitoshi@gmail.com Subject: Re: [PATCH] perf bench: fix memory allocation fail check in mem{set,cpy} workloads In-Reply-To: <1370518503-4230-1-git-send-email-kirill.shutemov@linux.intel.com> References: <1370518503-4230-1-git-send-email-kirill.shutemov@linux.intel.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?ISO-2022-JP-2?B?R29qGyQoRCtXGyhC?=) APEL/10.8 Emacs/24.2 (x86_64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2146 Lines: 65 Hi Kirill, At Thu, 6 Jun 2013 14:35:03 +0300, Kirill A. Shutemov wrote: > > From: "Kirill A. Shutemov" > > 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 > > Signed-off-by: Kirill A. Shutemov > --- > 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/ -- 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/