From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932610AbcGHPVA (ORCPT ); Fri, 8 Jul 2016 11:21:00 -0400 Received: from mx1.redhat.com ([209.132.183.28]:59771 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932536AbcGHPUt (ORCPT ); Fri, 8 Jul 2016 11:20:49 -0400 Date: Fri, 8 Jul 2016 17:20:46 +0200 From: Jiri Olsa To: Song Shan Gong Cc: acme@kernel.org, jolsa@kernel.org, dsahern@gmail.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH] [RFC V1]s390/perf: fix 'start' address of module's map Message-ID: <20160708152046.GI31763@krava> References: <1467856176-8712-1-git-send-email-gongss@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1467856176-8712-1-git-send-email-gongss@linux.vnet.ibm.com> User-Agent: Mutt/1.6.1 (2016-04-27) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Fri, 08 Jul 2016 15:20:48 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > +#include > +#include > +#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