From b50a132f22f5b279e29433cdc768dbb388f92d5b Mon Sep 17 00:00:00 2001 From: Robert Watson Date: Fri, 29 Aug 2003 19:27:09 +0000 Subject: [PATCH] More checking of M_PREPEND() return values: pass through link-layer Appletalk code. These changes are untested since I don't have an Appletalk environment. --- sys/netatalk/aarp.c | 6 ++++++ sys/netatalk/ddp_output.c | 2 ++ 2 files changed, 8 insertions(+) diff --git a/sys/netatalk/aarp.c b/sys/netatalk/aarp.c index b4370973e85..abe66571d3a 100644 --- a/sys/netatalk/aarp.c +++ b/sys/netatalk/aarp.c @@ -167,6 +167,9 @@ aarpwhohas( struct arpcom *ac, struct sockaddr_at *sat ) sizeof( eh->ether_dhost )); eh->ether_type = htons(sizeof(struct llc) + sizeof(struct ether_aarp)); M_PREPEND( m, sizeof( struct llc ), M_TRYWAIT ); + if ( m == NULL ) { + return; + } llc = mtod( m, struct llc *); llc->llc_dsap = llc->llc_ssap = LLC_SNAP_LSAP; llc->llc_control = LLC_UI; @@ -581,6 +584,9 @@ aarpprobe( void *arg ) eh->ether_type = htons( sizeof( struct llc ) + sizeof( struct ether_aarp )); M_PREPEND( m, sizeof( struct llc ), M_TRYWAIT ); + if ( m == NULL ) { + return; + } llc = mtod( m, struct llc *); llc->llc_dsap = llc->llc_ssap = LLC_SNAP_LSAP; llc->llc_control = LLC_UI; diff --git a/sys/netatalk/ddp_output.c b/sys/netatalk/ddp_output.c index f15914be2bb..5f7874da38a 100644 --- a/sys/netatalk/ddp_output.c +++ b/sys/netatalk/ddp_output.c @@ -56,6 +56,8 @@ ddp_output( struct mbuf *m, struct socket *so) #endif M_PREPEND( m, sizeof( struct ddpehdr ), M_TRYWAIT ); + if ( m == NULL ) + return( ENOBUFS ); deh = mtod( m, struct ddpehdr *); deh->deh_pad = 0;