Merge remote-tracking branch 'torvalds/master' into perf/core
[linux-2.6-microblaze.git] / tools / perf / util / synthetic-events.c
index b698046..35aa0c0 100644 (file)
@@ -424,7 +424,7 @@ int perf_event__synthesize_mmap_events(struct perf_tool *tool,
 
        while (!io.eof) {
                static const char anonstr[] = "//anon";
-               size_t size;
+               size_t size, aligned_size;
 
                /* ensure null termination since stack will be reused. */
                event->mmap2.filename[0] = '\0';
@@ -484,11 +484,12 @@ out:
                }
 
                size = strlen(event->mmap2.filename) + 1;
-               size = PERF_ALIGN(size, sizeof(u64));
+               aligned_size = PERF_ALIGN(size, sizeof(u64));
                event->mmap2.len -= event->mmap.start;
                event->mmap2.header.size = (sizeof(event->mmap2) -
-                                       (sizeof(event->mmap2.filename) - size));
-               memset(event->mmap2.filename + size, 0, machine->id_hdr_size);
+                                       (sizeof(event->mmap2.filename) - aligned_size));
+               memset(event->mmap2.filename + size, 0, machine->id_hdr_size +
+                       (aligned_size - size));
                event->mmap2.header.size += machine->id_hdr_size;
                event->mmap2.pid = tgid;
                event->mmap2.tid = pid;
@@ -758,7 +759,7 @@ static int __event__synthesize_thread(union perf_event *comm_event,
        for (i = 0; i < n; i++) {
                char *end;
                pid_t _pid;
-               bool kernel_thread;
+               bool kernel_thread = false;
 
                _pid = strtol(dirent[i]->d_name, &end, 10);
                if (*end)
@@ -1210,7 +1211,7 @@ static size_t mask_size(struct perf_cpu_map *map, int *max)
        *max = 0;
 
        for (i = 0; i < map->nr; i++) {
-               /* bit possition of the cpu is + 1 */
+               /* bit position of the cpu is + 1 */
                int bit = map->map[i] + 1;
 
                if (bit > *max)
@@ -1236,7 +1237,7 @@ void *cpu_map_data__alloc(struct perf_cpu_map *map, size_t *size, u16 *type, int
         *   mask  = size of 'struct perf_record_record_cpu_map' +
         *           maximum cpu bit converted to size of longs
         *
-        * and finaly + the size of 'struct perf_record_cpu_map_data'.
+        * and finally + the size of 'struct perf_record_cpu_map_data'.
         */
        size_cpus = cpus_size(map);
        size_mask = mask_size(map, max);