[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160708152046.GI31763@krava>
Date: Fri, 8 Jul 2016 17:20:46 +0200
From: Jiri Olsa <jolsa@...hat.com>
To: Song Shan Gong <gongss@...ux.vnet.ibm.com>
Cc: acme@...nel.org, jolsa@...nel.org, dsahern@...il.com,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] [RFC V1]s390/perf: fix 'start' address of module's map
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
Powered by blists - more mailing lists