lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Wed, 17 Mar 2010 11:27:35 GMT From: tip-bot for Masami Hiramatsu <mhiramat@...hat.com> To: linux-tip-commits@...r.kernel.org Cc: linux-kernel@...r.kernel.org, paulus@...ba.org, acme@...hat.com, hpa@...or.com, mingo@...hat.com, a.p.zijlstra@...llo.nl, efault@....de, dle-develop@...ts.sourceforge.net, fweisbec@...il.com, tglx@...utronix.de, mhiramat@...hat.com, mingo@...e.hu, systemtap@...rces.redhat.com Subject: [tip:perf/core] perf tools: Introduce xzalloc() for detecting out of memory conditions Commit-ID: a1d37d5285bcda07f9c0b80a2634ca20ab545297 Gitweb: http://git.kernel.org/tip/a1d37d5285bcda07f9c0b80a2634ca20ab545297 Author: Masami Hiramatsu <mhiramat@...hat.com> AuthorDate: Tue, 16 Mar 2010 18:05:21 -0400 Committer: Ingo Molnar <mingo@...e.hu> CommitDate: Wed, 17 Mar 2010 11:32:29 +0100 perf tools: Introduce xzalloc() for detecting out of memory conditions Introducing xzalloc() which wrapping zalloc() for detecting out of memory conditions. Signed-off-by: Masami Hiramatsu <mhiramat@...hat.com> Cc: systemtap <systemtap@...rces.redhat.com> Cc: DLE <dle-develop@...ts.sourceforge.net> Cc: Frederic Weisbecker <fweisbec@...il.com> Cc: Arnaldo Carvalho de Melo <acme@...hat.com> Cc: Paul Mackerras <paulus@...ba.org> Cc: Mike Galbraith <efault@....de> Cc: Peter Zijlstra <a.p.zijlstra@...llo.nl> LKML-Reference: <20100316220521.32050.85155.stgit@...alhost6.localdomain6> [ -v2: small cleanups in surrounding code ] Signed-off-by: Ingo Molnar <mingo@...e.hu> --- tools/perf/util/util.h | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-) diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h index 0f5b2a6..5270108 100644 --- a/tools/perf/util/util.h +++ b/tools/perf/util/util.h @@ -295,6 +295,13 @@ extern void *xmemdupz(const void *data, size_t len); extern char *xstrndup(const char *str, size_t len); extern void *xrealloc(void *ptr, size_t size) __attribute__((weak)); +static inline void *xzalloc(size_t size) +{ + void *buf = xmalloc(size); + + return memset(buf, 0, size); +} + static inline void *zalloc(size_t size) { return calloc(1, size); @@ -309,6 +316,7 @@ static inline int has_extension(const char *filename, const char *ext) { size_t len = strlen(filename); size_t extlen = strlen(ext); + return len > extlen && !memcmp(filename + len - extlen, ext, extlen); } @@ -322,6 +330,7 @@ static inline int has_extension(const char *filename, const char *ext) #undef isalnum #undef tolower #undef toupper + extern unsigned char sane_ctype[256]; #define GIT_SPACE 0x01 #define GIT_DIGIT 0x02 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@...r.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists