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] [day] [month] [year] [list]
Date:   Tue, 21 Nov 2017 21:37:25 +0100
From:   SF Markus Elfring <elfring@...rs.sourceforge.net>
To:     shuah@...nel.org, linux-pm@...r.kernel.org,
        Thomas Renninger <trenn@...e.com>
Cc:     LKML <linux-kernel@...r.kernel.org>,
        kernel-janitors@...r.kernel.org,
        Shuah Khan <shuahkh@....samsung.com>
Subject: Re: [PATCH] cpupower: Combine two condition checks into one statement
 in get_cpu_topology()

>> @@ -140,18 +140,12 @@ int get_cpu_topology(struct cpupower_topology *cpu_top)
>>  	for (cpu = 0; cpu < cpus; cpu++) {
>>  		cpu_top->core_info[cpu].cpu = cpu;
>>  		cpu_top->core_info[cpu].is_online = cpupower_is_cpu_online(cpu);
>> -		if(sysfs_topology_read_file(
>> -			cpu,
>> -			"physical_package_id",
>> -			&(cpu_top->core_info[cpu].pkg)) < 0) {
>> -			cpu_top->core_info[cpu].pkg = -1;
>> -			cpu_top->core_info[cpu].core = -1;
>> -			continue;
>> -		}
>> -		if(sysfs_topology_read_file(
>> -			cpu,
>> -			"core_id",
>> -			&(cpu_top->core_info[cpu].core)) < 0) {
>> +		if (sysfs_topology_read_file(cpu, "physical_package_id",
>> +					     &(cpu_top->core_info[cpu].pkg))
>> +		    < 0 ||
>> +		    sysfs_topology_read_file(cpu, "core_id",
>> +					     &(cpu_top->core_info[cpu].core))
>> +		    < 0) {
> 
> This change takes the easily readable code into hard to read code,

I got other views around code readability for the shown software
design direction.


> even though it removes the duplicate code in the conditional.

Would you like to reduce a bit of duplicate code here?


> Please find a better way to make it not so hard to read.

Which source code layout would you find more appropriate then
in this use case?

Regards,
Markus

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ