From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753863AbbDUJZr (ORCPT ); Tue, 21 Apr 2015 05:25:47 -0400 Received: from mga02.intel.com ([134.134.136.20]:22694 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752437AbbDUJZp (ORCPT ); Tue, 21 Apr 2015 05:25:45 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.11,614,1422950400"; d="scan'208";a="698461802" Message-ID: <55361718.9030300@intel.com> Date: Tue, 21 Apr 2015 12:23:36 +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:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: Arnaldo Carvalho de Melo CC: Peter Zijlstra , linux-kernel@vger.kernel.org, David Ahern , Frederic Weisbecker , Jiri Olsa , Namhyung Kim , Stephane Eranian Subject: Re: [PATCH 03/44] perf tools: Add user events for AUX area tracing References: <1428594864-29309-1-git-send-email-adrian.hunter@intel.com> <1428594864-29309-4-git-send-email-adrian.hunter@intel.com> <20150420230645.GV11111@kernel.org> In-Reply-To: <20150420230645.GV11111@kernel.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 21/04/15 02:06, Arnaldo Carvalho de Melo wrote: > Em Thu, Apr 09, 2015 at 06:53:43PM +0300, Adrian Hunter escreveu: >> +static int skipn(int fd, off_t n) >> +{ >> + char buf[4096]; >> + ssize_t ret; >> + >> + while (n > 0) { >> + ret = read(fd, buf, MIN(n, sizeof(buf))); >> + if (ret <= 0) >> + return ret; >> + n -= ret; >> + } >> + >> + return 0; > > We have min() in tools/perf/util/include/linux/kernel.h, and that is > what is being used elsewhere in tools/perf/: > > [acme@zoo linux]$ find tools/perf/ -name "*.[ch]" | xargs grep '\ | wc -l > 20 > [acme@zoo linux]$ find tools/perf/ -name "*.[ch]" | xargs grep '\ | wc -l > 8 > [acme@zoo linux]$ > > I noticed it tho because of this: > > util/session.c: In function ‘skipn’: > util/session.c:279:28: error: comparison between signed and unsigned > integer expressions [-Werror=sign-compare] > ret = read(fd, buf, MIN(n, sizeof(buf))); > ^ > util/session.c:279:47: error: signed and unsigned type in conditional > expression [-Werror=sign-compare] > ret = read(fd, buf, MIN(n, sizeof(buf))); > ^ > cc1: all warnings being treated as errors > make[3]: *** [/tmp/build/perf/util/session.o] Error 1 > make[3]: *** Waiting for unfinished jobs.... > > Fixing it to be: > > ret = read(fd, buf, min(n, (off_t)sizeof(buf))); > > Ok? Yes, thank you! There were 3 more patches using MIN so I have fixed and re-sent them.