Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934030Ab2HWPMQ (ORCPT ); Thu, 23 Aug 2012 11:12:16 -0400 Received: from merlin.infradead.org ([205.233.59.134]:50087 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754790Ab2HWPK2 (ORCPT ); Thu, 23 Aug 2012 11:10:28 -0400 From: Arnaldo Carvalho de Melo To: Ingo Molnar Cc: linux-kernel@vger.kernel.org, Namhyung Kim , Namhyung Kim , Frederic Weisbecker , Peter Zijlstra , Steven Rostedt , Arnaldo Carvalho de Melo Subject: [PATCH 12/12] tools lib traceevent: Fix off-by-one bug in pevent_strerror() Date: Thu, 23 Aug 2012 12:09:56 -0300 Message-Id: <1345734596-7601-13-git-send-email-acme@infradead.org> X-Mailer: git-send-email 1.7.9.2.358.g22243 In-Reply-To: <1345734596-7601-1-git-send-email-acme@infradead.org> References: <1345734596-7601-1-git-send-email-acme@infradead.org> Content-Type: text/plain; charset="UTF-8" X-SRS-Rewrite: SMTP reverse-path rewritten from by canuck.infradead.org See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1453 Lines: 39 From: Namhyung Kim As pevent_errno is defined using PEVENT_ERRORS which uses _PE macro magic, the first errno is bigger than __PEVENT_ERRNO_START by 1. So we need to subtract the 1 also when calculating the index of the error strings. Signed-off-by: Namhyung Kim Cc: Frederic Weisbecker Cc: Ingo Molnar Cc: Peter Zijlstra Cc: Steven Rostedt Link: http://lkml.kernel.org/r/1345707420-21767-1-git-send-email-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/lib/traceevent/event-parse.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c index f978c59..b5b4d80 100644 --- a/tools/lib/traceevent/event-parse.c +++ b/tools/lib/traceevent/event-parse.c @@ -4822,7 +4822,7 @@ int pevent_strerror(struct pevent *pevent, enum pevent_errno errnum, errnum >= __PEVENT_ERRNO__END) return -1; - idx = errnum - __PEVENT_ERRNO__START; + idx = errnum - __PEVENT_ERRNO__START - 1; msg = pevent_error_str[idx]; switch (errnum) { -- 1.7.1 -- 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/