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: <tencent_B16F0FDE60249B5B302F900AE6EEE48C4F06@qq.com>
Date: Wed, 23 Apr 2025 22:48:35 +0800
From: 1425075683@...com
To: robin.murphy@....com
Cc: 1425075683@...com,
	devicetree@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	robh@...nel.org,
	saravanak@...gle.com
Subject: Re: [PATCH] of: Build warn for missing fn() in _OF_DECLARE

>On 2025-04-17 2:23 pm, Liya Huang wrote:
>> The function pointer fn() in _OF_DECLARE macro might be NULL. For example,
>> in __reserved_mem_init_node(), only non-NULL cases are handled, and NULL
>> function pointers are ignored.
>> 
>> This patch introduces a check to handle cases where fn() is NULL. If fn()
>> is found to be NULL, a warning is issued during compilation to notify
>> developers about the missing function pointer.
>> 
>> ---
>> The function pointer fn() in _OF_DECLARE macro might be NULL. For example,
>> in __reserved_mem_init_node(), only non-NULL cases are handled, and NULL
>> function pointers are ignored.
>> 
>> This patch introduces a check to handle cases where fn() is NULL. If fn()
>> is found to be NULL, a warning is issued during compilation to notify
>> developers about the missing function pointer.
>
>This patch in -next appears to be responsible for syzbot complaining 
>about build errors for some configs:
>
>"
>kernel/dma/coherent.c:410:1: error: static assertion expression is not 
>an integral constant expression
>kernel/dma/contiguous.c:497:1: error: static assertion expression is not 
>an integral constant expression
>"
>
>https://lore.kernel.org/linux-iommu/6808d00a.050a0220.7184a.0010.GAE@google.com/
>
>Also on closer inspection, just outside the diff context we still seem 
>to be explicitly anticipating fn being NULL with:
>
>	.data = (fn == (fn_type)NULL) ? fn : fn
>
>so something doesn't seem quite right...
>
>Thanks,
>Robin.

I tested this patch, and it compiled successfully with GCC but failed with
Clang.I couldn't find a better way to consistently check for null function
pointers during compilation across these two compilers.
I even tried using the method of preventing negative array indexing, but 
it failed to compile with GCC instead.
Perhaps it would be better to abandon this patch. :(

--
Thanks, 
Liya Huang <1425075683@...com>


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ