From nobody Thu Sep 18 19:42:03 2025 X-Original-To: freebsd-net@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4cSQyF3XHRz67wGJ; Thu, 18 Sep 2025 19:42:13 +0000 (UTC) (envelope-from paul@redbarn.org) Received: from util.redbarn.org (util.redbarn.org [IPv6:2001:559:8000:cd::222]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "*.redbarn.org", Issuer "RapidSSL TLS RSA CA G1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4cSQyF0lwgz3JDQ; Thu, 18 Sep 2025 19:42:13 +0000 (UTC) (envelope-from paul@redbarn.org) Authentication-Results: mx1.freebsd.org; none Received: from family.redbarn.org (family.redbarn.org [24.104.150.213]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "*.redbarn.org", Issuer "RapidSSL TLS RSA CA G1" (not verified)) by util.redbarn.org (Postfix) with ESMTPS id 1ADC3160BFE; Thu, 18 Sep 2025 19:42:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=redbarn.org; s=util; t=1758224525; bh=kJ3XK4YZ1/dMKXAKF/SLxRejHW2qcSUR413By8r5Z9Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=qcn6xp9D+7p3FlFNUZPTofmxT9sUGYeFmFiMWYM44xyvwmU6ZUHxrf8/OJBJLeVtO p+X7Mta3NxlKPl9tCgKJwe12U33hGq/y/0jE7pJ1ePGmoNstGIm4ypsBEYDNdhtuTk cATNszRmLHWkoVa6sMJjDUOKqky4jsIQKuTsIzLk= Received: from localhost.localnet (2606-4e80-1201-0016-b906-21eb-116e-3550.722262346536e7a17254ef7541820776.ip6.frontiernet.net [IPv6:2606:4e80:1201:16:b906:21eb:116e:3550]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by family.redbarn.org (Postfix) with ESMTPSA id 324919; Thu, 18 Sep 2025 19:42:04 +0000 (UTC) From: Paul Vixie To: Nakayama Kenjiro , freebsd-net@freebsd.org Cc: freebsd-hackers@freebsd.org, freebsd-net@freebsd.org, Zhenlei Huang Subject: Re: Build failure with Clang/LLVM 22 due to alloc-size diagnostic Date: Thu, 18 Sep 2025 19:42:03 +0000 Message-ID: <4985340.OV4Wx5bFTl@localhost> Organization: FW In-Reply-To: <9B7C5718-5F5E-46FB-BB97-0F75FB5CD117@FreeBSD.org> References: <9B7C5718-5F5E-46FB-BB97-0F75FB5CD117@FreeBSD.org> List-Id: Networking and TCP/IP with FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-net List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-net@FreeBSD.org MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="nextPart27054142.1r3eYUQgxm" Content-Transfer-Encoding: 7Bit X-Spamd-Bar: ---- X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:33651, ipnet:2001:559:8000::/48, country:US] X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Rspamd-Queue-Id: 4cSQyF0lwgz3JDQ 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 > > ... > > 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"

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--