Commit 5b572e25 authored by Matthew Wilcox's avatar Matthew Wilcox Committed by Kees Cook
Browse files

Convert virtio_console to struct_size

parent 8958fd41
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -433,8 +433,7 @@ static struct port_buffer *alloc_buf(struct virtio_device *vdev, size_t buf_size
	 * Allocate buffer and the sg list. The sg list array is allocated
	 * directly after the port_buffer struct.
	 */
	buf = kmalloc(sizeof(*buf) + sizeof(struct scatterlist) * pages,
		      GFP_KERNEL);
	buf = kmalloc(struct_size(buf, sg, pages), GFP_KERNEL);
	if (!buf)
		goto fail;