treewide: kmalloc() -> kmalloc_array()
[linux-block.git] / kernel / trace / trace.c
index 108ce3e1dc1374c21e8fc7fbc9756e095cb314fe..8ea8550156138e6edb800c8209cfe080151209d8 100644 (file)
@@ -1751,12 +1751,13 @@ static inline void set_cmdline(int idx, const char *cmdline)
 static int allocate_cmdlines_buffer(unsigned int val,
                                    struct saved_cmdlines_buffer *s)
 {
-       s->map_cmdline_to_pid = kmalloc(val * sizeof(*s->map_cmdline_to_pid),
-                                       GFP_KERNEL);
+       s->map_cmdline_to_pid = kmalloc_array(val,
+                                             sizeof(*s->map_cmdline_to_pid),
+                                             GFP_KERNEL);
        if (!s->map_cmdline_to_pid)
                return -ENOMEM;
 
-       s->saved_cmdlines = kmalloc(val * TASK_COMM_LEN, GFP_KERNEL);
+       s->saved_cmdlines = kmalloc_array(TASK_COMM_LEN, val, GFP_KERNEL);
        if (!s->saved_cmdlines) {
                kfree(s->map_cmdline_to_pid);
                return -ENOMEM;
@@ -5063,7 +5064,7 @@ trace_insert_eval_map_file(struct module *mod, struct trace_eval_map **start,
         * where the head holds the module and length of array, and the
         * tail holds a pointer to the next list.
         */
-       map_array = kmalloc(sizeof(*map_array) * (len + 2), GFP_KERNEL);
+       map_array = kmalloc_array(len + 2, sizeof(*map_array), GFP_KERNEL);
        if (!map_array) {
                pr_warn("Unable to allocate trace eval mapping\n");
                return;