From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751937AbcGORQ7 (ORCPT ); Fri, 15 Jul 2016 13:16:59 -0400 Received: from smtprelay0040.hostedemail.com ([216.40.44.40]:43701 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751900AbcGORQ5 (ORCPT ); Fri, 15 Jul 2016 13:16:57 -0400 X-Session-Marker: 726F737465647440676F6F646D69732E6F7267 X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,rostedt@goodmis.org,:::::::::::::::::,RULES_HIT:41:355:379:541:599:800:960:973:988:989:1260:1277:1311:1313:1314:1345:1359:1437:1515:1516:1518:1534:1540:1593:1594:1711:1730:1747:1777:1792:2393:2553:2559:2562:2693:3138:3139:3140:3141:3142:3352:3622:3865:3866:3867:3870:3872:3874:4321:5007:6261:7875:7901:10004:10400:10450:10455:10848:10967:11232:11658:11914:12517:12519:12663:12740:13069:13311:13357:13439:14096:14097:14181:14659:14721:19904:19999:21080:30054:30070:30090:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:2,LUA_SUMMARY:none X-HE-Tag: fowl08_22e1b875112a X-Filterd-Recvd-Size: 2156 Date: Fri, 15 Jul 2016 13:16:53 -0400 From: Steven Rostedt To: Jiri Olsa Cc: Jiri Pirko , Jiri Olsa , Arnaldo Carvalho de Melo , lkml , David Ahern , Ingo Molnar , Namhyung Kim , Peter Zijlstra Subject: Re: [PATCH 1/3] perf script python: Fix string vs byte array resolving Message-ID: <20160715131653.4c9ac475@gandalf.local.home> In-Reply-To: <20160715161310.GA831@krava> References: <1468567797-27564-1-git-send-email-jolsa@kernel.org> <1468567797-27564-2-git-send-email-jolsa@kernel.org> <20160715155110.GF1983@nanopsycho.orion> <20160715120231.4539632f@gandalf.local.home> <20160715161310.GA831@krava> X-Mailer: Claws Mail 3.13.2 (GTK+ 2.24.30; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 15 Jul 2016 18:13:10 +0200 Jiri Olsa wrote: > On Fri, Jul 15, 2016 at 12:02:31PM -0400, Steven Rostedt wrote: > > SNIP > > > > for "AA\1\0" this returns "1" although that should return "0". > > > > > > orig len 4 > > > decremented len 3 > > > for: > > > 0 1 > > > > > > index 2 would not be inspected. Or am I missing something? > > > > > > I think that the for check should be "i < len" > > > > Yes it should be. I think we got the two solutions mixed up. > > > > With the above len--, it should be i < len, but when we did the check > > for zero at the end, we needed the i < len - 1 > > ugh right.. should be 'i < len' check in the for loop, > > there's also the patch 2/3 that needs to be changed > I'm wondering if we should also add at the beginning: if (!len) return 0; Otherwise we will be accessing out of bounds with the len-1. -- Steve