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: <2ffc8633-6ed8-4641-bd9f-313645dfff51@csgroup.eu>
Date: Wed, 3 Apr 2024 09:03:54 +0000
From: Christophe Leroy <christophe.leroy@...roup.eu>
To: Arnd Bergmann <arnd@...db.de>, Arnd Bergmann <arnd@...nel.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>, Andrew Morton
	<akpm@...ux-foundation.org>, Palmer Dabbelt <palmer@...osinc.com>
CC: Dave Hansen <dave.hansen@...ux.intel.com>, Noah Goldstein
	<goldstein.w.n@...il.com>, Charlie Jenkins <charlie@...osinc.com>
Subject: Re: [PATCH 18/34] lib: checksum: hide unused
 expected_csum_ipv6_magic[]



Le 03/04/2024 à 10:58, Arnd Bergmann a écrit :
> On Wed, Apr 3, 2024, at 10:41, Christophe Leroy wrote:
>> Le 03/04/2024 à 10:06, Arnd Bergmann a écrit :
>>> From: Arnd Bergmann <arnd@...db.de>
>>>
>>> When CONFIG_NET is disabled, an extra warning shows up for this
>>> unused variable:
>>>
>>> lib/checksum_kunit.c:218:18: error: 'expected_csum_ipv6_magic' defined but not used [-Werror=unused-const-variable=]
>>>
>>> Hide it under the same #ifdef as the reference to it.
>>>
>>> Fixes: f24a70106dc1 ("lib: checksum: Fix build with CONFIG_NET=n")
>>
>> I think that commit introduced unjustified #ifdef in a C file.
> 
>> Refer
>> https://docs.kernel.org/process/coding-style.html#conditional-compilation
>>
>> The fix should be:
>>
>> +	if (!IS_ENABLED(CONFIG_NET))
>> +		return;
>> +
>>    	for (int i = 0; i < NUM_IPv6_TESTS; i++) {
>>    		saddr = (const struct in6_addr *)(random_buf + i);
>>    		daddr = (const struct in6_addr *)(random_buf + i +
>> @@ -618,7 +620,6 @@ static void test_csum_ipv6_magic(struct kunit *test)
>>    		CHECK_EQ(to_sum16(expected_csum_ipv6_magic[i]),
>>    			 csum_ipv6_magic(saddr, daddr, len, proto, csum));
>>    	}
>> -#endif /* !CONFIG_NET */
> 
> Yes, I usually prefer that approach, and I think I tried it first
> but ran into compile-time problems because csum_ipv6_magic()
> is declared conditionally. Let me try again, maybe I misremember
> what I did or I can remove some more #ifdef checks for this.

FWIW, before replying I did a build check with pmac32_defconfig 
(powerpc) with CONFIG_NET removed. I was able to build 
lib/checksum_kunit.o and objdump shown there was no reference to 
csum_ipv6_magic() inside it.

Christophe

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ