summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorTom Lendacky <thomas.lendacky@amd.com>2015-10-05 17:51:03 +0200
committerDavid S. Miller <davem@davemloft.net>2015-10-06 08:30:51 +0200
commit855591d2f7d1ff7eb18b60ce2be494e3bfe27fb8 (patch)
tree0f660f069392b98eac4e8cf2db9bdc80ce1a3e18 /drivers
parentopenvswitch: Fix ovs_vport_get_stats() (diff)
downloadlinux-855591d2f7d1ff7eb18b60ce2be494e3bfe27fb8.tar.xz
linux-855591d2f7d1ff7eb18b60ce2be494e3bfe27fb8.zip
amd-xgbe: Check for successful buffer allocation before use
The kasprintf function can return NULL if the allocation fails. Check for successful allocation before attempting to use the returned buffer. Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/ethernet/amd/xgbe/xgbe-debugfs.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-debugfs.c b/drivers/net/ethernet/amd/xgbe/xgbe-debugfs.c
index 66137ffea3f8..96f485ab612e 100644
--- a/drivers/net/ethernet/amd/xgbe/xgbe-debugfs.c
+++ b/drivers/net/ethernet/amd/xgbe/xgbe-debugfs.c
@@ -327,6 +327,9 @@ void xgbe_debugfs_init(struct xgbe_prv_data *pdata)
pdata->debugfs_xpcs_reg = 0;
buf = kasprintf(GFP_KERNEL, "amd-xgbe-%s", pdata->netdev->name);
+ if (!buf)
+ return;
+
pdata->xgbe_debugfs = debugfs_create_dir(buf, NULL);
if (!pdata->xgbe_debugfs) {
netdev_err(pdata->netdev, "debugfs_create_dir failed\n");