Browse Source

[efi] Always allow MAX_LL_HEADER_LEN for the link-layer header

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 14 years ago
parent
commit
308615cd97
1 changed files with 4 additions and 1 deletions
  1. 4
    1
      src/interface/efi/efi_snp.c

+ 4
- 1
src/interface/efi/efi_snp.c View File

530
 		container_of ( snp, struct efi_snp_device, snp );
530
 		container_of ( snp, struct efi_snp_device, snp );
531
 	struct ll_protocol *ll_protocol = snpdev->netdev->ll_protocol;
531
 	struct ll_protocol *ll_protocol = snpdev->netdev->ll_protocol;
532
 	struct io_buffer *iobuf;
532
 	struct io_buffer *iobuf;
533
+	size_t ll_headroom;
533
 	int rc;
534
 	int rc;
534
 	EFI_STATUS efirc;
535
 	EFI_STATUS efirc;
535
 
536
 
582
 	}
583
 	}
583
 
584
 
584
 	/* Allocate buffer */
585
 	/* Allocate buffer */
585
-	iobuf = alloc_iob ( len );
586
+	ll_headroom = ( MAX_LL_HEADER_LEN - ll_header_len );
587
+	iobuf = alloc_iob ( ll_headroom + len );
586
 	if ( ! iobuf ) {
588
 	if ( ! iobuf ) {
587
 		DBGC ( snpdev, "SNPDEV %p TX could not allocate %ld-byte "
589
 		DBGC ( snpdev, "SNPDEV %p TX could not allocate %ld-byte "
588
 		       "buffer\n", snpdev, ( ( unsigned long ) len ) );
590
 		       "buffer\n", snpdev, ( ( unsigned long ) len ) );
589
 		efirc = EFI_DEVICE_ERROR;
591
 		efirc = EFI_DEVICE_ERROR;
590
 		goto err_alloc_iob;
592
 		goto err_alloc_iob;
591
 	}
593
 	}
594
+	iob_reserve ( iobuf, ll_headroom );
592
 	memcpy ( iob_put ( iobuf, len ), data, len );
595
 	memcpy ( iob_put ( iobuf, len ), data, len );
593
 
596
 
594
 	/* Create link-layer header, if specified */
597
 	/* Create link-layer header, if specified */

Loading…
Cancel
Save