[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1475265381-28937-2-git-send-email-linville@tuxdriver.com>
Date: Fri, 30 Sep 2016 15:56:15 -0400
From: "John W. Linville" <linville@...driver.com>
To: netdev@...r.kernel.org
Cc: "John W. Linville" <linville@...driver.com>
Subject: [PATCH 1/7] ethtool: avoid NULL pointer dereference in do_permaddr
Coverity issue: 1363118
Fixes: fef1c4a19703 ("ethtool: add get permanent address option")
Signed-off-by: John W. Linville <linville@...driver.com>
---
ethtool.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/ethtool.c b/ethtool.c
index 6287b559c699..aa3ef5ed2f75 100644
--- a/ethtool.c
+++ b/ethtool.c
@@ -3941,6 +3941,11 @@ static int do_permaddr(struct cmd_context *ctx)
struct ethtool_perm_addr *epaddr;
epaddr = malloc(sizeof(struct ethtool_perm_addr) + MAX_ADDR_LEN);
+ if (!epaddr) {
+ perror("Cannot allocate memory for operation");
+ return 1;
+ }
+
epaddr->cmd = ETHTOOL_GPERMADDR;
epaddr->size = MAX_ADDR_LEN;
--
2.7.4
Powered by blists - more mailing lists