Skip to contentSkip to conversation

hv: util: checking the wrong variable

PATCH New Dan Carpenter 1 participant 1 message May 29, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hv: util: checking the wrong variable

We don't catch this allocation failure because there is a typo and we check the wrong variable.

Fixes 14b50f80c32d ('Drivers: hv: util: introduce hv_utils_transport abstraction')
drivers/hv/hv_utils_transport.c +1 -1
index ea7ba5e..6a9d80a 100644
@@ -186,7 +186,7 @@ int hvutil_transport_send(struct hvutil_transport *hvt, void *msg, int len)
 		return -EINVAL;
 	} else if (hvt->mode = HVUTIL_TRANSPORT_NETLINK) {
 		cn_msg = kzalloc(sizeof(*cn_msg) + len, GFP_ATOMIC);
-		if (!msg)
+		if (!cn_msg)
 			return -ENOMEM;
 		cn_msg->id.idx = hvt->cn_id.idx;
 		cn_msg->id.val = hvt->cn_id.val;