Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752158AbbHaJqo (ORCPT ); Mon, 31 Aug 2015 05:46:44 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55631 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751322AbbHaJqn (ORCPT ); Mon, 31 Aug 2015 05:46:43 -0400 Date: Mon, 31 Aug 2015 11:46:38 +0200 From: Jiri Olsa To: Kan Liang Cc: acme@kernel.org, jolsa@kernel.org, a.p.zijlstra@chello.nl, luto@kernel.org, mingo@redhat.com, eranian@google.com, ak@linux.intel.com, mark.rutland@arm.com, adrian.hunter@intel.com, namhyung@kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH V7 1/8] perf,tools: introduce generic FEAT for CPU attributes Message-ID: <20150831094638.GF22039@krava.brq.redhat.com> References: <1440755289-30939-1-git-send-email-kan.liang@intel.com> <1440755289-30939-2-git-send-email-kan.liang@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1440755289-30939-2-git-send-email-kan.liang@intel.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1145 Lines: 41 On Fri, Aug 28, 2015 at 05:48:02AM -0400, Kan Liang wrote: SNIP > > +static int process_cpu_attributes(struct perf_file_section *section __maybe_unused, > + struct perf_header *ph, int fd, > + void *data __maybe_unused) > +{ > + ssize_t ret; > + u32 i, tag_id; > + u64 nr; > + > + for (i = 0; i < PERF_HEADER_CPU_ATTR_MAX; i++) { > + > + ret = readn(fd, &tag_id, sizeof(tag_id)); > + if (ret != sizeof(tag_id)) > + return -1; > + > + if (ph->needs_swap) > + nr = bswap_32(tag_id); > + > + if (tag_id >= PERF_HEADER_CPU_ATTR_MAX) { > + pr_debug("The number of cpu attributes is not expected. " > + "You may need to upgrade the perf tool.\n"); > + return -1; > + } I wonder we should let it pass to be able to read new data with older perf.. but IMO the error is specific enough to find & fix it if it ever happens Acked-by: Jiri Olsa thanks, jirka -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/