Date: Thu, 18 Sep 2025 19:42:03 +0000 From: Paul Vixie <paul@redbarn.org> To: Nakayama Kenjiro <nakayamakenjiro@gmail.com>, freebsd-net@freebsd.org Cc: freebsd-hackers@freebsd.org, freebsd-net@freebsd.org, Zhenlei Huang <zlei@freebsd.org> Subject: Re: Build failure with Clang/LLVM 22 due to alloc-size diagnostic Message-ID: <4985340.OV4Wx5bFTl@localhost> In-Reply-To: <9B7C5718-5F5E-46FB-BB97-0F75FB5CD117@FreeBSD.org> References: <CAA_ZtA_184k892=5v0OtZsjweWSgSCX%2BWWR6se_aVCJCAh-apQ@mail.gmail.com> <9B7C5718-5F5E-46FB-BB97-0F75FB5CD117@FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format. --nextPart27054142.1r3eYUQgxm Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" On Donderdag 18 September 2025 14:29:36 UTC Zhenlei Huang wrote: > > On Sep 18, 2025, at 7:17 PM, Nakayama Kenjiro <nakayamakenjiro@gmail.com> > > ... > > 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 --nextPart27054142.1r3eYUQgxm Content-Transfer-Encoding: 7Bit Content-Type: text/html; charset="us-ascii" <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> </head> <body><p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">On Donderdag 18 September 2025 14:29:36 UTC Zhenlei Huang wrote:</p> <p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">> > On Sep 18, 2025, at 7:17 PM, Nakayama Kenjiro <nakayamakenjiro@gmail.com></p> <p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">> > ...</p> <p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">> > freebsd/sys/netinet/in_mcast.c:749:10: error: allocation of insufficient</p> <p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">> > size '40' for type 'struct ip_msource' with size '48'</p> <p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">> > ...</p> <p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">> The following lines has this</p> <p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">> ```</p> <p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">> lims = (struct in_msource *)nims;</p> <p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">> ```</p> <p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">> </p> <p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">> So probably assign the alloced memory directly to lims would make Clang</p> <p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">> happy, say ```</p> <p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">> lims = malloc(sizeof( .... ;</p> <p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">> nims = (struct ip_mfilter *)lims;</p> <p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">> ```</p> <p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">> </p> <p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">> You can have a try with that. Good luck with you !</p> <br /><p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">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?</p> <br /><p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">-- </p> <p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">Paul Vixie</p> </body> </html> --nextPart27054142.1r3eYUQgxm--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4985340.OV4Wx5bFTl>