mirror of
https://github.com/ep00ch/lwip-contrib-mac.git
synced 2024-07-04 15:29:30 +00:00
pkdrv/if: fixed check for invalid adapter_num, added assert if netif can't be initialized
This commit is contained in:
parent
234cfd1dcf
commit
5f05529a22
@ -166,11 +166,13 @@ init_adapter(int adapter_num, char *mac_addr, input_fn input, void *arg)
|
||||
}
|
||||
/* invalid adapter index -> check this after printing the adapters */
|
||||
if (adapter_num < 0) {
|
||||
printf("Invalid adapter_num: %d\n", adapter_num);
|
||||
free(pa);
|
||||
return NULL;
|
||||
}
|
||||
/* adapter index out of range */
|
||||
if (adapter_num >= AdapterNum) {
|
||||
if (adapter_num > AdapterNum) {
|
||||
printf("Invalid adapter_num: %d\n", adapter_num);
|
||||
free(pa);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -122,6 +122,7 @@ low_level_init(struct netif *netif)
|
||||
if ((netif->state = init_adapter(PACKET_LIB_ADAPTER_NR, adapter_mac_addr,
|
||||
ethernetif_process_input, netif)) == NULL) {
|
||||
printf("ERROR initializing network adapter %d!\n", PACKET_LIB_ADAPTER_NR);
|
||||
LWIP_ASSERT("ERROR initializing network adapter!\n", 0);
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user