|
@@ -40,7 +40,7 @@ struct pk_buff * alloc_pkb ( size_t len ) {
|
40
|
40
|
void *data;
|
41
|
41
|
|
42
|
42
|
/* Align buffer length */
|
43
|
|
- len = ( len + __alignof__ ( *pkb ) - 1 ) & ~ __alignof__ ( *pkb );
|
|
43
|
+ len = ( len + __alignof__( *pkb ) - 1 ) & ~( __alignof__( *pkb ) - 1 );
|
44
|
44
|
|
45
|
45
|
/* Allocate memory for buffer plus descriptor */
|
46
|
46
|
data = malloc_dma ( len + sizeof ( *pkb ), PKBUFF_ALIGN );
|
|
@@ -60,6 +60,9 @@ struct pk_buff * alloc_pkb ( size_t len ) {
|
60
|
60
|
*/
|
61
|
61
|
void free_pkb ( struct pk_buff *pkb ) {
|
62
|
62
|
if ( pkb ) {
|
|
63
|
+ assert ( pkb->head <= pkb->data );
|
|
64
|
+ assert ( pkb->data <= pkb->tail );
|
|
65
|
+ assert ( pkb->tail <= pkb->end );
|
63
|
66
|
free_dma ( pkb->head,
|
64
|
67
|
( pkb->end - pkb->head ) + sizeof ( *pkb ) );
|
65
|
68
|
}
|