Unverified Commit e4bd0053 authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!3981 vhost: use kzalloc() instead of kmalloc() followed by memset()

parents 4ab210f9 79d78b3c
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -2597,12 +2597,11 @@ EXPORT_SYMBOL_GPL(vhost_disable_notify);
/* Create a new message. */
struct vhost_msg_node *vhost_new_msg(struct vhost_virtqueue *vq, int type)
{
	struct vhost_msg_node *node = kmalloc(sizeof *node, GFP_KERNEL);
	/* Make sure all padding within the structure is initialized. */
	struct vhost_msg_node *node = kzalloc(sizeof(*node), GFP_KERNEL);
	if (!node)
		return NULL;

	/* Make sure all padding within the structure is initialized. */
	memset(&node->msg, 0, sizeof node->msg);
	node->vq = vq;
	node->msg.type = type;
	return node;