On Thu, Jul 07, 2016 at 09:49:36AM +0800, Song Shan Gong wrote:

SNIP

> +libperf-y += sym-handling.o
> diff --git a/tools/perf/arch/s390/util/sym-handling.c 
> b/tools/perf/arch/s390/util/sym-handling.c
> new file mode 100644
> index 0000000..efe2a50
> --- /dev/null
> +++ b/tools/perf/arch/s390/util/sym-handling.c
> @@ -0,0 +1,49 @@
> +#include <stdio.h>
> +#include <stdlib.h>
> +#include <unistd.h>
> +#include "symbol.h"
> +#include "map.h"
> +#include "util.h"
> +#include "machine.h"
> +
> +int arch__fix_module_baseaddr(struct machine *machine,
> +             u64 *start, const char *name)
> +{
> +     char path[PATH_MAX];
> +     char *module_name = strdup(name);

we have a rule to check on every allocated pointer,
pelase check module_name != NULL before using it

> +     int len = strlen(module_name);
> +     FILE *file;
> +     int err = 0;
> +     u64 text_start;
> +     char *line = NULL;
> +     size_t n;
> +     char *sep;
> +
> +     module_name[len - 1] = '\0';
> +     module_name += 1;

hum, why do increase the pointer?

thanks,
jirka

Reply via email to