diff options
Diffstat (limited to 'kernel/trace/trace.c')
| -rw-r--r-- | kernel/trace/trace.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index 108ce3e1dc13..c9336e98ac59 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c | |||
| @@ -1751,12 +1751,13 @@ static inline void set_cmdline(int idx, const char *cmdline) | |||
| 1751 | static int allocate_cmdlines_buffer(unsigned int val, | 1751 | static int allocate_cmdlines_buffer(unsigned int val, |
| 1752 | struct saved_cmdlines_buffer *s) | 1752 | struct saved_cmdlines_buffer *s) |
| 1753 | { | 1753 | { |
| 1754 | s->map_cmdline_to_pid = kmalloc(val * sizeof(*s->map_cmdline_to_pid), | 1754 | s->map_cmdline_to_pid = kmalloc_array(val, |
| 1755 | GFP_KERNEL); | 1755 | sizeof(*s->map_cmdline_to_pid), |
| 1756 | GFP_KERNEL); | ||
| 1756 | if (!s->map_cmdline_to_pid) | 1757 | if (!s->map_cmdline_to_pid) |
| 1757 | return -ENOMEM; | 1758 | return -ENOMEM; |
| 1758 | 1759 | ||
| 1759 | s->saved_cmdlines = kmalloc(val * TASK_COMM_LEN, GFP_KERNEL); | 1760 | s->saved_cmdlines = kmalloc_array(TASK_COMM_LEN, val, GFP_KERNEL); |
| 1760 | if (!s->saved_cmdlines) { | 1761 | if (!s->saved_cmdlines) { |
| 1761 | kfree(s->map_cmdline_to_pid); | 1762 | kfree(s->map_cmdline_to_pid); |
| 1762 | return -ENOMEM; | 1763 | return -ENOMEM; |
| @@ -4360,7 +4361,8 @@ int set_tracer_flag(struct trace_array *tr, unsigned int mask, int enabled) | |||
| 4360 | 4361 | ||
| 4361 | if (mask == TRACE_ITER_RECORD_TGID) { | 4362 | if (mask == TRACE_ITER_RECORD_TGID) { |
| 4362 | if (!tgid_map) | 4363 | if (!tgid_map) |
| 4363 | tgid_map = kzalloc((PID_MAX_DEFAULT + 1) * sizeof(*tgid_map), | 4364 | tgid_map = kcalloc(PID_MAX_DEFAULT + 1, |
| 4365 | sizeof(*tgid_map), | ||
| 4364 | GFP_KERNEL); | 4366 | GFP_KERNEL); |
| 4365 | if (!tgid_map) { | 4367 | if (!tgid_map) { |
| 4366 | tr->trace_flags &= ~TRACE_ITER_RECORD_TGID; | 4368 | tr->trace_flags &= ~TRACE_ITER_RECORD_TGID; |
| @@ -5063,7 +5065,7 @@ trace_insert_eval_map_file(struct module *mod, struct trace_eval_map **start, | |||
| 5063 | * where the head holds the module and length of array, and the | 5065 | * where the head holds the module and length of array, and the |
| 5064 | * tail holds a pointer to the next list. | 5066 | * tail holds a pointer to the next list. |
| 5065 | */ | 5067 | */ |
| 5066 | map_array = kmalloc(sizeof(*map_array) * (len + 2), GFP_KERNEL); | 5068 | map_array = kmalloc_array(len + 2, sizeof(*map_array), GFP_KERNEL); |
| 5067 | if (!map_array) { | 5069 | if (!map_array) { |
| 5068 | pr_warn("Unable to allocate trace eval mapping\n"); | 5070 | pr_warn("Unable to allocate trace eval mapping\n"); |
| 5069 | return; | 5071 | return; |
