Coverity issue: 1363118
Fixes: fef1c4a19703 ("ethtool: add get permanent address option")

Signed-off-by: John W. Linville <linvi...@tuxdriver.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

Reply via email to