Skip to content

Commit 5b8ff81

Browse files
minosgalanakishug-dev
authored andcommitted
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 <[email protected]>
1 parent ccff46d commit 5b8ff81

File tree

1 file changed

+4
-4
lines changed
  • features/FEATURE_LWIP/lwip-interface/lwip-eth/arch/TARGET_CM3DS_MPS2

1 file changed

+4
-4
lines changed

features/FEATURE_LWIP/lwip-interface/lwip-eth/arch/TARGET_CM3DS_MPS2/mps2_emac.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* mbed Microcontroller Library
2-
* Copyright (c) 2017 ARM Limited
2+
* Copyright (c) 2017-2018 ARM Limited
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* 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)
316316
err_t error = ERR_OK;
317317
struct ethernetif *ethernetif;
318318

319-
ethernetif->is_enabled = 0;
320-
321319
LWIP_ASSERT("netif != NULL", (netif != NULL));
322-
323320
ethernetif = mem_malloc(sizeof(struct ethernetif));
321+
324322
if (ethernetif == NULL) {
325323
LWIP_DEBUGF(NETIF_DEBUG, ("ethernetif_init: out of memory\n"));
326324
return ERR_MEM;
327325
}
328326

327+
ethernetif->is_enabled = 0;
328+
329329
#if LWIP_NETIF_HOSTNAME
330330
/* Initialize interface hostname */
331331
netif->hostname = HOSTNAME_STRING;

0 commit comments

Comments
 (0)