All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 1/1] net: core: avoid possible NULL pointer dereference
@ 2017-05-16  3:07 Heinrich Schuchardt
  2017-05-30 16:59 ` Joe Hershberger
  2017-06-02 19:48 ` [U-Boot] " Joe Hershberger
  0 siblings, 2 replies; 3+ messages in thread
From: Heinrich Schuchardt @ 2017-05-16  3:07 UTC (permalink / raw)
  To: u-boot

Checking if dev is NULL after dereferencing it does not make sense.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
---
 net/eth-uclass.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/eth-uclass.c b/net/eth-uclass.c
index c3cc3152a2..b659961a5d 100644
--- a/net/eth-uclass.c
+++ b/net/eth-uclass.c
@@ -181,7 +181,7 @@ int eth_get_dev_index(void)
 
 static int eth_write_hwaddr(struct udevice *dev)
 {
-	struct eth_pdata *pdata = dev->platdata;
+	struct eth_pdata *pdata;
 	int ret = 0;
 
 	if (!dev || !device_active(dev))
@@ -189,6 +189,7 @@ static int eth_write_hwaddr(struct udevice *dev)
 
 	/* seq is valid since the device is active */
 	if (eth_get_ops(dev)->write_hwaddr && !eth_mac_skip(dev->seq)) {
+		pdata = dev->platdata;
 		if (!is_valid_ethaddr(pdata->enetaddr)) {
 			printf("\nError: %s address %pM illegal value\n",
 			       dev->name, pdata->enetaddr);
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [U-Boot] [PATCH 1/1] net: core: avoid possible NULL pointer dereference
  2017-05-16  3:07 [U-Boot] [PATCH 1/1] net: core: avoid possible NULL pointer dereference Heinrich Schuchardt
@ 2017-05-30 16:59 ` Joe Hershberger
  2017-06-02 19:48 ` [U-Boot] " Joe Hershberger
  1 sibling, 0 replies; 3+ messages in thread
From: Joe Hershberger @ 2017-05-30 16:59 UTC (permalink / raw)
  To: u-boot

On Mon, May 15, 2017 at 10:07 PM, Heinrich Schuchardt
<xypron.glpk@gmx.de> wrote:
> Checking if dev is NULL after dereferencing it does not make sense.

Yes, it was incorrect, but fortunately it was never used for anything,
so even though it's garbage if the dev is NULL, at least we didn't use
it for anything in that case.

> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

Acked-by: Joe Hershberger <joe.hershberger@ni.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [U-Boot] net: core: avoid possible NULL pointer dereference
  2017-05-16  3:07 [U-Boot] [PATCH 1/1] net: core: avoid possible NULL pointer dereference Heinrich Schuchardt
  2017-05-30 16:59 ` Joe Hershberger
@ 2017-06-02 19:48 ` Joe Hershberger
  1 sibling, 0 replies; 3+ messages in thread
From: Joe Hershberger @ 2017-06-02 19:48 UTC (permalink / raw)
  To: u-boot

Hi xypron.glpk at gmx.de,

https://patchwork.ozlabs.org/patch/762783/ was applied to u-boot-net.git.

Thanks!
-Joe

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-06-02 19:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-16  3:07 [U-Boot] [PATCH 1/1] net: core: avoid possible NULL pointer dereference Heinrich Schuchardt
2017-05-30 16:59 ` Joe Hershberger
2017-06-02 19:48 ` [U-Boot] " Joe Hershberger

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.