summaryrefslogtreecommitdiffstats
path: root/drivers/oprofile
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2009-01-27 12:01:51 +0100
committerIngo Molnar <mingo@elte.hu>2009-01-27 12:01:51 +0100
commit3ddeb51d9c83931c1ca6abf76a38934c5a1ed918 (patch)
treefc2efb59d627135ea2199a8a68415b162646b121 /drivers/oprofile
parent5a611268b69f05262936dd177205acbce4471358 (diff)
parent5ee810072175042775e39bdd3eaaa68884c27805 (diff)
downloadop-kernel-dev-3ddeb51d9c83931c1ca6abf76a38934c5a1ed918.zip
op-kernel-dev-3ddeb51d9c83931c1ca6abf76a38934c5a1ed918.tar.gz
Merge branch 'linus' into core/percpu
Conflicts: arch/x86/kernel/setup_percpu.c
Diffstat (limited to 'drivers/oprofile')
-rw-r--r--drivers/oprofile/cpu_buffer.c5
-rw-r--r--drivers/oprofile/cpu_buffer.h7
2 files changed, 12 insertions, 0 deletions
diff --git a/drivers/oprofile/cpu_buffer.c b/drivers/oprofile/cpu_buffer.c
index 2e03b6d..e76d715 100644
--- a/drivers/oprofile/cpu_buffer.c
+++ b/drivers/oprofile/cpu_buffer.c
@@ -393,16 +393,21 @@ oprofile_write_reserve(struct op_entry *entry, struct pt_regs * const regs,
return;
fail:
+ entry->event = NULL;
cpu_buf->sample_lost_overflow++;
}
int oprofile_add_data(struct op_entry *entry, unsigned long val)
{
+ if (!entry->event)
+ return 0;
return op_cpu_buffer_add_data(entry, val);
}
int oprofile_write_commit(struct op_entry *entry)
{
+ if (!entry->event)
+ return -EINVAL;
return op_cpu_buffer_write_commit(entry);
}
diff --git a/drivers/oprofile/cpu_buffer.h b/drivers/oprofile/cpu_buffer.h
index 63f81c4..272995d 100644
--- a/drivers/oprofile/cpu_buffer.h
+++ b/drivers/oprofile/cpu_buffer.h
@@ -66,6 +66,13 @@ static inline void op_cpu_buffer_reset(int cpu)
cpu_buf->last_task = NULL;
}
+/*
+ * op_cpu_buffer_add_data() and op_cpu_buffer_write_commit() may be
+ * called only if op_cpu_buffer_write_reserve() did not return NULL or
+ * entry->event != NULL, otherwise entry->size or entry->event will be
+ * used uninitialized.
+ */
+
struct op_sample
*op_cpu_buffer_write_reserve(struct op_entry *entry, unsigned long size);
int op_cpu_buffer_write_commit(struct op_entry *entry);
OpenPOWER on IntegriCloud