Skip to content

Commit a297042

Browse files
bvanasscheingomolnar
authored andcommitted
stacktrace: Constify 'entries' arguments
Make it clear to humans and to the compiler that the stack trace ('entries') arguments are not modified. Signed-off-by: Bart Van Assche <bvanassche@acm.org> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Waiman Long <longman@redhat.com> Cc: Will Deacon <will.deacon@arm.com> Link: https://lkml.kernel.org/r/20190722182443.216015-3-bvanassche@acm.org Signed-off-by: Ingo Molnar <mingo@kernel.org>
1 parent 364f6af commit a297042

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

‎include/linux/stacktrace.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ struct task_struct;
99
struct pt_regs;
1010

1111
#ifdef CONFIG_STACKTRACE
12-
void stack_trace_print(unsigned long *trace, unsigned int nr_entries,
12+
void stack_trace_print(const unsigned long *trace, unsigned int nr_entries,
1313
int spaces);
14-
int stack_trace_snprint(char *buf, size_t size, unsigned long *entries,
14+
int stack_trace_snprint(char *buf, size_t size, const unsigned long *entries,
1515
unsigned int nr_entries, int spaces);
1616
unsigned int stack_trace_save(unsigned long *store, unsigned int size,
1717
unsigned int skipnr);

‎kernel/stacktrace.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
* @nr_entries: Number of entries in the storage array
2121
* @spaces: Number of leading spaces to print
2222
*/
23-
void stack_trace_print(unsigned long *entries, unsigned int nr_entries,
23+
void stack_trace_print(const unsigned long *entries, unsigned int nr_entries,
2424
int spaces)
2525
{
2626
unsigned int i;
@@ -43,7 +43,7 @@ EXPORT_SYMBOL_GPL(stack_trace_print);
4343
*
4444
* Return: Number of bytes printed.
4545
*/
46-
int stack_trace_snprint(char *buf, size_t size, unsigned long *entries,
46+
int stack_trace_snprint(char *buf, size_t size, const unsigned long *entries,
4747
unsigned int nr_entries, int spaces)
4848
{
4949
unsigned int generated, i, total = 0;

0 commit comments

Comments
 (0)