All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: "Michael S. Tsirkin" <mst@redhat.com>,
	Igor Mammedov <imammedo@redhat.com>
Cc: kernel-janitors@vger.kernel.org, kvm@vger.kernel.org,
	virtualization@lists.linux-foundation.org
Subject: [patch] vhost: NULL vs ERR_PTR bug
Date: Wed, 15 Jul 2015 11:16:59 +0000	[thread overview]
Message-ID: <20150715111659.GA22854@mwanda> (raw)

There is only one caller for vhost_kvzalloc() and it expects NULL on
allocation failure.  Most people would probably expect that so let's
change ERR_PTR(-ENOMEM) to NULL.

Fixes: 4de7255f7d2b ('vhost: extend memory regions allocation to vmalloc')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
index a9fe859..99d613b 100644
--- a/drivers/vhost/vhost.c
+++ b/drivers/vhost/vhost.c
@@ -686,7 +686,7 @@ static void *vhost_kvzalloc(unsigned long size)
 	if (!n) {
 		n = vzalloc(size);
 		if (!n)
-			return ERR_PTR(-ENOMEM);
+			return NULL;
 	}
 	return n;
 }

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: "Michael S. Tsirkin" <mst@redhat.com>,
	Igor Mammedov <imammedo@redhat.com>
Cc: kernel-janitors@vger.kernel.org, kvm@vger.kernel.org,
	virtualization@lists.linux-foundation.org
Subject: [patch] vhost: NULL vs ERR_PTR bug
Date: Wed, 15 Jul 2015 14:16:59 +0300	[thread overview]
Message-ID: <20150715111659.GA22854@mwanda> (raw)

There is only one caller for vhost_kvzalloc() and it expects NULL on
allocation failure.  Most people would probably expect that so let's
change ERR_PTR(-ENOMEM) to NULL.

Fixes: 4de7255f7d2b ('vhost: extend memory regions allocation to vmalloc')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
index a9fe859..99d613b 100644
--- a/drivers/vhost/vhost.c
+++ b/drivers/vhost/vhost.c
@@ -686,7 +686,7 @@ static void *vhost_kvzalloc(unsigned long size)
 	if (!n) {
 		n = vzalloc(size);
 		if (!n)
-			return ERR_PTR(-ENOMEM);
+			return NULL;
 	}
 	return n;
 }

             reply	other threads:[~2015-07-15 11:16 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-15 11:16 Dan Carpenter [this message]
2015-07-15 11:16 ` [patch] vhost: NULL vs ERR_PTR bug Dan Carpenter
2015-07-15 11:28 ` Michael S. Tsirkin
2015-07-15 11:28   ` Michael S. Tsirkin
2015-07-15 11:35   ` walter harms
2015-07-15 11:35     ` walter harms
2015-07-15 11:41     ` Dan Carpenter
2015-07-15 11:41       ` Dan Carpenter
2015-07-15 14:21     ` Julia Lawall
2015-07-15 14:21     ` Julia Lawall
2015-07-15 14:21       ` Julia Lawall
2015-07-15 14:40       ` Dan Carpenter
2015-07-15 14:40         ` Dan Carpenter
2015-07-15 11:35   ` walter harms
2015-07-15 11:28 ` Michael S. Tsirkin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150715111659.GA22854@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=imammedo@redhat.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=virtualization@lists.linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.