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]
Date:   Wed, 24 Jun 2020 16:35:02 +0300
From:   Alexey Budankov <alexey.budankov@...ux.intel.com>
To:     Jiri Olsa <jolsa@...hat.com>,
        Arnaldo Carvalho de Melo <acme@...nel.org>
Cc:     Namhyung Kim <namhyung@...nel.org>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        Peter Zijlstra <peterz@...radead.org>,
        Ingo Molnar <mingo@...hat.com>,
        Andi Kleen <ak@...ux.intel.com>,
        linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v8 03/13] perf evlist: implement control command handling
 functions



On 23.06.2020 18:14, Jiri Olsa wrote:
> On Tue, Jun 23, 2020 at 12:03:45PM -0300, Arnaldo Carvalho de Melo wrote:
>> Em Tue, Jun 23, 2020 at 04:56:01PM +0200, Jiri Olsa escreveu:
>>> On Wed, Jun 17, 2020 at 11:36:46AM +0300, Alexey Budankov wrote:
>>>
>>> SNIP
>>>
>>>> +	memset(cmd_data, 0, data_size--);
>>>> +
>>>> +	do {
>>>> +		err = read(evlist->ctl_fd.fd, &c, 1);
>>>> +		if (err > 0) {
>>>> +			if (c == '\n' || c == '\0')
>>>> +				break;
>>>> +			cmd_data[bytes_read++] = c;
>>>> +			if (bytes_read == data_size)
>>>> +				break;
>>>> +		} else {
>>>> +			if (err == -1)
>>>> +				pr_err("Failed to read from ctlfd %d: %m\n", evlist->ctl_fd.fd);
>>>> +			break;
>>>> +		}
>>>> +	} while (1);
>>>> +
>>>> +	pr_debug("Message from ctl_fd: \"%s%s\"\n", cmd_data,
>>>> +		 bytes_read == data_size ? "" : c == '\n' ? "\\n" : "\\0");
>>>> +
>>>> +	if (err > 0) {
>>>> +		if (!strncmp(cmd_data, EVLIST_CTL_CMD_ENABLE_TAG,
>>>> +			     strlen(EVLIST_CTL_CMD_ENABLE_TAG))) {
>>>
>>> you could use sizeof(EVLIST_CTL_CMD_ENABLE_TAG) instead, no function call
>>
>> -1, as sizeof will get the \0, right?
> 
> yep, I think that's right

Ok, let's have it like (sizeof(EVLIST_CTL_CMD_ENABLE_TAG)-1).

~Alexey

> 
> jirka
> 
>>
>>>
>>>> +			*cmd = EVLIST_CTL_CMD_ENABLE;
>>>> +		} else if (!strncmp(cmd_data, EVLIST_CTL_CMD_DISABLE_TAG,
>>>> +				    strlen(EVLIST_CTL_CMD_DISABLE_TAG))) {
>>>
>>> ditto
>>>
>>> jirka
>>>
>>
>> -- 
>>
>> - Arnaldo
>>
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ