lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <55361718.9030300@intel.com>
Date:	Tue, 21 Apr 2015 12:23:36 +0300
From:	Adrian Hunter <adrian.hunter@...el.com>
To:	Arnaldo Carvalho de Melo <acme@...nel.org>
CC:	Peter Zijlstra <peterz@...radead.org>,
	linux-kernel@...r.kernel.org, David Ahern <dsahern@...il.com>,
	Frederic Weisbecker <fweisbec@...il.com>,
	Jiri Olsa <jolsa@...hat.com>,
	Namhyung Kim <namhyung@...il.com>,
	Stephane Eranian <eranian@...gle.com>
Subject: Re: [PATCH 03/44] perf tools: Add user events for AUX area tracing

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 '\<min('
> | wc -l
> 20
> [acme@zoo linux]$ find tools/perf/ -name "*.[ch]" | xargs grep '\<max('
> | 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.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ