Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp501752imm; Fri, 15 Jun 2018 01:15:01 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKL22Rsza5ZI6vYMK0ULWPJStuDApYCxFi4LSFH5XmzZI4FBPZKHQoXgHW9w+E1PUN4HEcl X-Received: by 2002:a63:902:: with SMTP id 2-v6mr629563pgj.3.1529050501149; Fri, 15 Jun 2018 01:15:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529050501; cv=none; d=google.com; s=arc-20160816; b=fNByVhJqh7Y1M7fnr55Ln8g6YpfhkahUleEMysNZwFxWhMG3c9kbU85yj1tU3ioMxG GYAgt5WdjFZD/rjp7jHjb1mUgCjHdYEDEFeqCU1uzbndfdT0LThLz1lWfdBv1+yIRf6P xjfYagxT/a0jWOPB/4qbQNcSZ0g8R9MHjYHFsRYZj30/2lXhWm6R84phKQkBatEUEp3E ZBgN/9Mocl/1eXp7I8CA3isuXMEIlsSCBCxSjRFArQEZeDfDtdMC5d8Y2lu57AuVNNKJ wED0G+Vbv3JgmXqtuwr/ixKzRd18Ic5L7rn0SMYZLTG4gYzGVHhuSnMnk+P3I7UTVl+L Ab0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=6agtdLEEZiBjbaExOlNFLbS/l+R3dpfNdopwxwSJXZI=; b=rXALMJ7FiWgOtBYPp5bjil0JdvQMct1o7AAqwFkQePW0RNS5kaUA8c1AlixYrSLQKI D2h2nEKUi4ZDbmrUfD6H0UFeCJHuYRiph69kVuWEoE7ohROAz/Cr7IHAjoSqKpHlbvhO FLB9M6NdY7vzhkQ0edMi9OLFTcNhiK8uCPGyY8czyNMTRke8/LQSyiPqR6l2C5nT29hm xXMEFSHJHBsIIlwg79jJ+uXuQg9EpH1+IbJbw6+nejTj3U6EIY6+c9bXIt87jqWGMsI/ k9hKgPdlTKG/KptimDKgkL6+IgOjj5LqqZZyqbFKyhJo+R17WOeMsZV/uEt+zST5ztkN Ndsw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w12-v6si7365624pfa.113.2018.06.15.01.14.46; Fri, 15 Jun 2018 01:15:01 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756028AbeFOIMq (ORCPT + 99 others); Fri, 15 Jun 2018 04:12:46 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:45946 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755847AbeFOIMp (ORCPT ); Fri, 15 Jun 2018 04:12:45 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9751C859C5; Fri, 15 Jun 2018 08:12:44 +0000 (UTC) Received: from krava (unknown [10.43.17.64]) by smtp.corp.redhat.com (Postfix) with SMTP id 5577120283A3; Fri, 15 Jun 2018 08:12:43 +0000 (UTC) Date: Fri, 15 Jun 2018 10:12:42 +0200 From: Jiri Olsa To: Paul Clarke Cc: Thomas Richter , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, acme@kernel.org, brueckner@linux.vnet.ibm.com, schwidefsky@de.ibm.com, heiko.carstens@de.ibm.com Subject: Re: [PATCH 2/3] perf alias: Rebuild alias expression string to make it comparable Message-ID: <20180615081242.GF5082@krava> References: <20180614114845.41221-1-tmricht@linux.ibm.com> <20180614114845.41221-2-tmricht@linux.ibm.com> <809ff562-511d-26e9-bac3-e8f7b84666e5@us.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <809ff562-511d-26e9-bac3-e8f7b84666e5@us.ibm.com> User-Agent: Mutt/1.9.1 (2017-09-22) X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Fri, 15 Jun 2018 08:12:44 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Fri, 15 Jun 2018 08:12:44 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'jolsa@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 14, 2018 at 08:53:14AM -0500, Paul Clarke wrote: SNIP > > + if (ret) > > + ret += scnprintf(newval + ret, sizeof(newval) - ret, > > + ","); > > + if (term->type_val == PARSE_EVENTS__TERM_TYPE_NUM) > > + ret += scnprintf(newval + ret, sizeof(newval) - ret, > > + "%s=%#x", term->config, term->val.num); > > + else if (term->type_val == PARSE_EVENTS__TERM_TYPE_STR) > > + ret += scnprintf(newval + ret, sizeof(newval) - ret, > > + "%s=%s", term->config, term->val.str); > > If we exceed 256, we just suddenly terminate the rebuilding without reporting any issues. > > > + } > > + > > alias->name = strdup(name); > > if (dir) { > > /* > > @@ -285,7 +308,7 @@ static int __perf_pmu__new_alias(struct list_head *list, char *dir, char *name, > > snprintf(alias->unit, sizeof(alias->unit), "%s", unit); > > } > > alias->per_pkg = perpkg && sscanf(perpkg, "%d", &num) == 1 && num == 1; > > - alias->str = strdup(val); > > + alias->str = strdup(newval); hum, how is newval different from val? AFAICS it's the same jirka