Re: Build failure with Clang/LLVM 22 due to alloc-size diagnostic

Paul Vixie <[email protected]>
Newsgroups gmane.os.freebsd.devel.net,gmane.os.freebsd.devel.hackers
Organization FW
Message-ID <4985340.OV4Wx5bFTl@localhost>
On Donderdag 18 September 2025 14:29:36 UTC Zhenlei Huang wrote:
> > On Sep 18, 2025, at 7:17 PM, Nakayama Kenjiro <[email protected]>
> > ...
> > freebsd/sys/netinet/in_mcast.c:749:10: error: allocation of insufficient
> > size '40' for type 'struct ip_msource' with size '48'
> > ...
> The following lines has this
> ```
> lims = (struct in_msource *)nims;
> ```
> 
> So probably assign the alloced memory directly to lims would make Clang
> happy, say ```
> lims = malloc(sizeof( .... ;
> nims = (struct ip_mfilter *)lims;
> ```
> 
> You can have a try with that. Good luck with you !

ideally, clang will eventually get around to complaining about that type cast on the same 
basis (destination points to a longer object than the source.) is there a reason we're not 
using a union{} for this data?

-- 
Paul Vixie
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.