public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
* [patch] vhost: NULL vs ERR_PTR bug
@ 2015-07-15 11:16 Dan Carpenter
  2015-07-15 11:28 ` Michael S. Tsirkin
  0 siblings, 1 reply; 6+ messages in thread
From: Dan Carpenter @ 2015-07-15 11:16 UTC (permalink / raw)
  To: Michael S. Tsirkin, Igor Mammedov; +Cc: kernel-janitors, kvm, virtualization

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;
 }

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-07-15 14:40 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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:35   ` walter harms
2015-07-15 11:41     ` Dan Carpenter
2015-07-15 14:21     ` Julia Lawall
2015-07-15 14:40       ` Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox