Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964838Ab2HWHny (ORCPT ); Thu, 23 Aug 2012 03:43:54 -0400 Received: from LGEMRELSE6Q.lge.com ([156.147.1.121]:45590 "EHLO LGEMRELSE6Q.lge.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751643Ab2HWHnv (ORCPT ); Thu, 23 Aug 2012 03:43:51 -0400 X-AuditID: 9c930179-b7cc4ae00000134d-54-5035df348a6a From: Namhyung Kim To: Steven Rostedt , Arnaldo Carvalho de Melo Cc: Frederic Weisbecker , Peter Zijlstra , Ingo Molnar , LKML , Namhyung Kim Subject: [PATCH] tools lib traceevent: Fix off-by-one bug in pevent_strerror() Date: Thu, 23 Aug 2012 16:37:00 +0900 Message-Id: <1345707420-21767-1-git-send-email-namhyung@kernel.org> X-Mailer: git-send-email 1.7.11.4 X-Brightmail-Tracker: AAAAAA== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1239 Lines: 35 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. Cc: Fredereic Weisbecker Cc: Steven Rostedt Signed-off-by: Namhyung Kim --- tools/lib/traceevent/event-parse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c index f978c59f67bf..b5b4d806ffa2 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.11.4 -- 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/