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

Commit 5abc03cd authored by Dan Carpenter's avatar Dan Carpenter Committed by Trond Myklebust
Browse files

NFS: kmalloc() doesn't return an ERR_PTR()



Obviously we should check for NULL here instead of IS_ERR().

Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Cc: stable@vger.kernel.org [3.4]
Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent 36be5051
Loading
Loading
Loading
Loading
+3 −7
Original line number Original line Diff line number Diff line
@@ -640,20 +640,16 @@ static int nfs_idmap_legacy_upcall(struct key_construction *cons,
	struct idmap_msg *im;
	struct idmap_msg *im;
	struct idmap *idmap = (struct idmap *)aux;
	struct idmap *idmap = (struct idmap *)aux;
	struct key *key = cons->key;
	struct key *key = cons->key;
	int ret;
	int ret = -ENOMEM;


	/* msg and im are freed in idmap_pipe_destroy_msg */
	/* msg and im are freed in idmap_pipe_destroy_msg */
	msg = kmalloc(sizeof(*msg), GFP_KERNEL);
	msg = kmalloc(sizeof(*msg), GFP_KERNEL);
	if (IS_ERR(msg)) {
	if (!msg)
		ret = PTR_ERR(msg);
		goto out0;
		goto out0;
	}


	im = kmalloc(sizeof(*im), GFP_KERNEL);
	im = kmalloc(sizeof(*im), GFP_KERNEL);
	if (IS_ERR(im)) {
	if (!im)
		ret = PTR_ERR(im);
		goto out1;
		goto out1;
	}


	ret = nfs_idmap_prepare_message(key->description, im, msg);
	ret = nfs_idmap_prepare_message(key->description, im, msg);
	if (ret < 0)
	if (ret < 0)