aboutsummaryrefslogtreecommitdiffstats
path: root/lib/stackdepot.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-02-07 01:15:42 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2018-02-07 01:15:42 -0500
commita2e5790d841658485d642196dbb0927303d6c22f (patch)
treeb3d28c9bcb7da6880806146fd22a88a7ee7f733e /lib/stackdepot.c
parentab2d92ad881da11331280aedf612d82e61cb6d41 (diff)
parent60c3e026d73ccabb075fb70ba02f8512ab40cf2c (diff)
Merge branch 'akpm' (patches from Andrew)
Merge misc updates from Andrew Morton: - kasan updates - procfs - lib/bitmap updates - other lib/ updates - checkpatch tweaks - rapidio - ubsan - pipe fixes and cleanups - lots of other misc bits * emailed patches from Andrew Morton <akpm@linux-foundation.org>: (114 commits) Documentation/sysctl/user.txt: fix typo MAINTAINERS: update ARM/QUALCOMM SUPPORT patterns MAINTAINERS: update various PALM patterns MAINTAINERS: update "ARM/OXNAS platform support" patterns MAINTAINERS: update Cortina/Gemini patterns MAINTAINERS: remove ARM/CLKDEV SUPPORT file pattern MAINTAINERS: remove ANDROID ION pattern mm: docs: add blank lines to silence sphinx "Unexpected indentation" errors mm: docs: fix parameter names mismatch mm: docs: fixup punctuation pipe: read buffer limits atomically pipe: simplify round_pipe_size() pipe: reject F_SETPIPE_SZ with size over UINT_MAX pipe: fix off-by-one error when checking buffer limits pipe: actually allow root to exceed the pipe buffer limits pipe, sysctl: remove pipe_proc_fn() pipe, sysctl: drop 'min' parameter from pipe-max-size converter kasan: rework Kconfig settings crash_dump: is_kdump_kernel can be boolean kernel/mutex: mutex_is_locked can be boolean ...
Diffstat (limited to 'lib/stackdepot.c')
-rw-r--r--lib/stackdepot.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/lib/stackdepot.c b/lib/stackdepot.c
index f87d138e9672..e513459a5601 100644
--- a/lib/stackdepot.c
+++ b/lib/stackdepot.c
@@ -163,6 +163,21 @@ static inline u32 hash_stack(unsigned long *entries, unsigned int size)
163 STACK_HASH_SEED); 163 STACK_HASH_SEED);
164} 164}
165 165
166/* Use our own, non-instrumented version of memcmp().
167 *
168 * We actually don't care about the order, just the equality.
169 */
170static inline
171int stackdepot_memcmp(const unsigned long *u1, const unsigned long *u2,
172 unsigned int n)
173{
174 for ( ; n-- ; u1++, u2++) {
175 if (*u1 != *u2)
176 return 1;
177 }
178 return 0;
179}
180
166/* Find a stack that is equal to the one stored in entries in the hash */ 181/* Find a stack that is equal to the one stored in entries in the hash */
167static inline struct stack_record *find_stack(struct stack_record *bucket, 182static inline struct stack_record *find_stack(struct stack_record *bucket,
168 unsigned long *entries, int size, 183 unsigned long *entries, int size,
@@ -173,10 +188,8 @@ static inline struct stack_record *find_stack(struct stack_record *bucket,
173 for (found = bucket; found; found = found->next) { 188 for (found = bucket; found; found = found->next) {
174 if (found->hash == hash && 189 if (found->hash == hash &&
175 found->size == size && 190 found->size == size &&
176 !memcmp(entries, found->entries, 191 !stackdepot_memcmp(entries, found->entries, size))
177 size * sizeof(unsigned long))) {
178 return found; 192 return found;
179 }
180 } 193 }
181 return NULL; 194 return NULL;
182} 195}