mirror of https://github.com/ARMmbed/mbed-os.git
CM3DS: fix a minor bug in the ethernet LWIP driver
This patch fixes a memory bug. `eth_arch_enetif_init` method call would attempt to write to un-initialized area of memory. Change-Id: I9881de71d58fa14db609fe3e24617a210b896471 Signed-off-by: Galanakis, Minos <minos.galanakis@arm.com>pull/6167/head
parent
ccff46d9a3
commit
5b8ff81e02
|
@ -1,5 +1,5 @@
|
||||||
/* mbed Microcontroller Library
|
/* mbed Microcontroller Library
|
||||||
* Copyright (c) 2017 ARM Limited
|
* Copyright (c) 2017-2018 ARM Limited
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -316,16 +316,16 @@ err_t eth_arch_enetif_init(struct netif *netif)
|
||||||
err_t error = ERR_OK;
|
err_t error = ERR_OK;
|
||||||
struct ethernetif *ethernetif;
|
struct ethernetif *ethernetif;
|
||||||
|
|
||||||
ethernetif->is_enabled = 0;
|
|
||||||
|
|
||||||
LWIP_ASSERT("netif != NULL", (netif != NULL));
|
LWIP_ASSERT("netif != NULL", (netif != NULL));
|
||||||
|
|
||||||
ethernetif = mem_malloc(sizeof(struct ethernetif));
|
ethernetif = mem_malloc(sizeof(struct ethernetif));
|
||||||
|
|
||||||
if (ethernetif == NULL) {
|
if (ethernetif == NULL) {
|
||||||
LWIP_DEBUGF(NETIF_DEBUG, ("ethernetif_init: out of memory\n"));
|
LWIP_DEBUGF(NETIF_DEBUG, ("ethernetif_init: out of memory\n"));
|
||||||
return ERR_MEM;
|
return ERR_MEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ethernetif->is_enabled = 0;
|
||||||
|
|
||||||
#if LWIP_NETIF_HOSTNAME
|
#if LWIP_NETIF_HOSTNAME
|
||||||
/* Initialize interface hostname */
|
/* Initialize interface hostname */
|
||||||
netif->hostname = HOSTNAME_STRING;
|
netif->hostname = HOSTNAME_STRING;
|
||||||
|
|
Loading…
Reference in New Issue