Date: Wed, 20 Oct 2004 07:55:32 +0200 (CEST) From: Harti Brandt <harti@freebsd.org> To: Andre Oppermann <andre@freebsd.org> Cc: Sam Leffler <sam@errno.com> Subject: Re: cvs commit: src/sys/sys protosw.h src/sys/kern uipc_domain.cuipc_socket2.c Message-ID: <20041020074747.B21281@beagle.kn.op.dlr.de> In-Reply-To: <41758B35.D5340AEA@freebsd.org> References: <200410191513.i9JFDUbf072176@repoman.freebsd.org> <417532A2.9000901@errno.com> <41753522.1E39FEAE@freebsd.org> <200410192329.46723.max@love2party.net> <41758B35.D5340AEA@freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 19 Oct 2004, Andre Oppermann wrote: AO>Max Laier wrote: AO>> example, in ip_icmp.c line 457 ff we have: AO>> AO>> ctlfunc = inetsw[ip_protox[icp->icmp_ip.ip_p]].pr_ctlinput; AO>> if (ctlfunc) AO>> (*ctlfunc)(code, (struct sockaddr *)&icmpsrc, AO>> (void *)&icp->icmp_ip); AO> AO>Ok, this one is easy to fix. I'll audit the code for any other of these AO>abuses. Actually it is not easy to fix. Even if you don't introduce a temporary variable the compiler can and probably will still use a temporary copy of the function pointer. AO>The point of the protocol arrays is precisely to have them as the only AO>and sole place where such information is stored. Any code that copies AO>any part of it to its own private structures is horribly broken by design AO>and must be fixed anyway! (BTW: I'm not aware of any code within netinet/* AO>that does this.) You cannot prevent the compiler from makeing temporary copies. harti
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20041020074747.B21281>