diff options
author | Kirill A. Shutemov <kirill.shutemov@linux.intel.com> | 2013-06-06 07:35:03 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2013-07-08 16:35:40 -0400 |
commit | 13966721a11f4a2ba8038191e48083b5f31822bb (patch) | |
tree | c46c44f7bd94c62c79b50e722a17fe34787ec5ef /tools | |
parent | 107de3724eff5a6fa6474a4d2aa5460b63749ebf (diff) |
perf bench: Fix memory allocation fail check in mem{set,cpy} workloads
Addresses of allocated memory areas saved to '*src' and '*dst', so we
need to check them for NULL, not 'src' and 'dst'.
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Acked-by: Hitoshi Mitake <mitake.hitoshi@lab.ntt.co.jp>
Cc: Hitoshi Mitake <h.mitake@gmail.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1370518503-4230-1-git-send-email-kirill.shutemov@linux.intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/bench/mem-memcpy.c | 4 | ||||
-rw-r--r-- | 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 93c83e3cb4a7..25fd3f1966f1 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) | |||
111 | static void alloc_mem(void **dst, void **src, size_t length) | 111 | static void alloc_mem(void **dst, void **src, size_t length) |
112 | { | 112 | { |
113 | *dst = zalloc(length); | 113 | *dst = zalloc(length); |
114 | if (!dst) | 114 | if (!*dst) |
115 | die("memory allocation failed - maybe length is too large?\n"); | 115 | die("memory allocation failed - maybe length is too large?\n"); |
116 | 116 | ||
117 | *src = zalloc(length); | 117 | *src = zalloc(length); |
118 | if (!src) | 118 | if (!*src) |
119 | die("memory allocation failed - maybe length is too large?\n"); | 119 | die("memory allocation failed - maybe length is too large?\n"); |
120 | } | 120 | } |
121 | 121 | ||
diff --git a/tools/perf/bench/mem-memset.c b/tools/perf/bench/mem-memset.c index c6e4bc523492..4a2f12081964 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) | |||
111 | static void alloc_mem(void **dst, size_t length) | 111 | static void alloc_mem(void **dst, size_t length) |
112 | { | 112 | { |
113 | *dst = zalloc(length); | 113 | *dst = zalloc(length); |
114 | if (!dst) | 114 | if (!*dst) |
115 | die("memory allocation failed - maybe length is too large?\n"); | 115 | die("memory allocation failed - maybe length is too large?\n"); |
116 | } | 116 | } |
117 | 117 | ||