Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ed36b4db authored by Christophe Jaillet's avatar Christophe Jaillet Committed by Dan Williams
Browse files

libnvdimm, btt: check memory allocation failure



Check memory allocation failures and return -ENOMEM in such cases, as
already done few lines below for another memory allocation.

This avoids NULL pointers dereference.

Cc: <stable@vger.kernel.org>
Fixes: 14e49454 ("libnvdimm, btt: BTT updates for UEFI 2.7 format")
Signed-off-by: default avatarChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: default avatarVishal Verma <vishal.l.verma@intel.com>
Signed-off-by: default avatarDan Williams <dan.j.williams@intel.com>
parent 02881768
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -1429,6 +1429,8 @@ int nvdimm_namespace_attach_btt(struct nd_namespace_common *ndns)
	}

	btt_sb = devm_kzalloc(&nd_btt->dev, sizeof(*btt_sb), GFP_KERNEL);
	if (!btt_sb)
		return -ENOMEM;

	/*
	 * If this returns < 0, that is ok as it just means there wasn't