H. Peter Anvin
2013-Nov-26 19:02 UTC
[syslinux] syslinux.efi pxeboot across multiple subnets
On 11/24/2013 03:29 AM, Gene Cumm wrote:>> >> (Sorry for the top posting.) > > I just started examining this and find it odd that the core_udp_recv() > doesn't zalloc() its token while core_udp_send()/core_udp_sendto() do. > All three are a part of commit fe283b78 by Matt Fleming. Should this > be made into a zalloc() rather than pushing it into the stack? It'd > seem like it could run some stack issues plus there's no guarantee > what's in it (unless there's some stack trickery just before the calls > to core_udp_recv() ) >As long as it doesn't need to live longer than the function it is in, using the stack seems sensible, but there might be a good reason to memset() it to zero. I have to admit that the use of zalloc() in some places and on the stack in others looks odd. It is worth noting that the Syslinux malloc implementation is rather slow. -hpa
On Tue, Nov 26, 2013 at 2:02 PM, H. Peter Anvin <hpa at zytor.com> wrote:> On 11/24/2013 03:29 AM, Gene Cumm wrote: >>> >>> (Sorry for the top posting.) >> >> I just started examining this and find it odd that the core_udp_recv() >> doesn't zalloc() its token while core_udp_send()/core_udp_sendto() do. >> All three are a part of commit fe283b78 by Matt Fleming. Should this >> be made into a zalloc() rather than pushing it into the stack? It'd >> seem like it could run some stack issues plus there's no guarantee >> what's in it (unless there's some stack trickery just before the calls >> to core_udp_recv() ) >> > > As long as it doesn't need to live longer than the function it is in, > using the stack seems sensible, but there might be a good reason to > memset() it to zero. > > I have to admit that the use of zalloc() in some places and on the stack > in others looks odd. It is worth noting that the Syslinux malloc > implementation is rather slow. > > -hpaAt least in these particular implementations of these functions, we're probably not using Syslinux's malloc() since it's all EFI and appears to use AllocatePool() (unless I misread it). -- -Gene
H. Peter Anvin
2013-Nov-28 04:39 UTC
[syslinux] syslinux.efi pxeboot across multiple subnets
On 11/27/2013 08:26 PM, Gene Cumm wrote:>> >> I have to admit that the use of zalloc() in some places and on the stack >> in others looks odd. It is worth noting that the Syslinux malloc >> implementation is rather slow. >> > At least in these particular implementations of these functions, we're > probably not using Syslinux's malloc() since it's all EFI and appears > to use AllocatePool() (unless I misread it). >Not sure that is any better... -hpa