From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755297Ab3HGINg (ORCPT ); Wed, 7 Aug 2013 04:13:36 -0400 Received: from mga01.intel.com ([192.55.52.88]:53989 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751139Ab3HGINd (ORCPT ); Wed, 7 Aug 2013 04:13:33 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.89,831,1367996400"; d="scan'208";a="382524424" Message-ID: <52020314.7080708@intel.com> Date: Wed, 07 Aug 2013 11:19:32 +0300 From: Adrian Hunter Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130625 Thunderbird/17.0.7 MIME-Version: 1.0 To: Namhyung Kim CC: Arnaldo Carvalho de Melo , linux-kernel@vger.kernel.org, David Ahern , Frederic Weisbecker , Jiri Olsa , Mike Galbraith , Paul Mackerras , Peter Zijlstra , Stephane Eranian , Ingo Molnar Subject: Re: [PATCH V9 05/14] perf tools: tidy up sample parsing overflow checking References: <1375719994-26482-1-git-send-email-adrian.hunter@intel.com> <1375719994-26482-6-git-send-email-adrian.hunter@intel.com> <87txj1ylb7.fsf@sejong.aot.lge.com> In-Reply-To: <87txj1ylb7.fsf@sejong.aot.lge.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 07/08/13 11:09, Namhyung Kim wrote: > On Mon, 5 Aug 2013 19:26:25 +0300, Adrian Hunter wrote: >> The size of data retrieved from a sample event must be >> validated to ensure it does not go past the end of the >> event. That was being done sporadically and without >> considering integer overflows. > > Wouldn't it be great if the macro (or something) can do all three things > together - checking overflow, getting current value (pointer) and > advancing the array to the size? Is that possible? Macros are not the answer to everything.