lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210517090836.533-13-xieyongji@bytedance.com>
Date:   Mon, 17 May 2021 17:08:31 +0800
From:   Xie Yongji <xieyongji@...edance.com>
To:     mst@...hat.com, jasowang@...hat.com, stefanha@...hat.com
Cc:     amit@...nel.org, arei.gonglei@...wei.com, airlied@...ux.ie,
        kraxel@...hat.com, dan.j.williams@...el.com,
        johannes@...solutions.net, ohad@...ery.com,
        bjorn.andersson@...aro.org, david@...hat.com, vgoyal@...hat.com,
        miklos@...redi.hu, sgarzare@...hat.com,
        virtualization@...ts.linux-foundation.org,
        linux-kernel@...r.kernel.org
Subject: [RFC PATCH 12/17] virtio_balloon: Remove unused used length

The used length is not used. Let's drop it and
pass NULL to virtqueue_get_buf() instead.

Signed-off-by: Xie Yongji <xieyongji@...edance.com>
---
 drivers/virtio/virtio_balloon.c | 21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)

diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c
index 510e9318854d..7565970c3901 100644
--- a/drivers/virtio/virtio_balloon.c
+++ b/drivers/virtio/virtio_balloon.c
@@ -152,7 +152,6 @@ static void balloon_ack(struct virtqueue *vq)
 static void tell_host(struct virtio_balloon *vb, struct virtqueue *vq)
 {
 	struct scatterlist sg;
-	unsigned int len;
 
 	sg_init_one(&sg, vb->pfns, sizeof(vb->pfns[0]) * vb->num_pfns);
 
@@ -161,7 +160,7 @@ static void tell_host(struct virtio_balloon *vb, struct virtqueue *vq)
 	virtqueue_kick(vq);
 
 	/* When host has read buffer, this completes via balloon_ack */
-	wait_event(vb->acked, virtqueue_get_buf(vq, &len));
+	wait_event(vb->acked, virtqueue_get_buf(vq, NULL));
 
 }
 
@@ -171,7 +170,7 @@ static int virtballoon_free_page_report(struct page_reporting_dev_info *pr_dev_i
 	struct virtio_balloon *vb =
 		container_of(pr_dev_info, struct virtio_balloon, pr_dev_info);
 	struct virtqueue *vq = vb->reporting_vq;
-	unsigned int unused, err;
+	unsigned int err;
 
 	/* We should always be able to add these buffers to an empty queue. */
 	err = virtqueue_add_inbuf(vq, sg, nents, vb, GFP_NOWAIT | __GFP_NOWARN);
@@ -187,7 +186,7 @@ static int virtballoon_free_page_report(struct page_reporting_dev_info *pr_dev_i
 	virtqueue_kick(vq);
 
 	/* When host has read buffer, this completes via balloon_ack */
-	wait_event(vb->acked, virtqueue_get_buf(vq, &unused));
+	wait_event(vb->acked, virtqueue_get_buf(vq, NULL));
 
 	return 0;
 }
@@ -386,7 +385,7 @@ static void stats_handle_request(struct virtio_balloon *vb)
 	num_stats = update_balloon_stats(vb);
 
 	vq = vb->stats_vq;
-	if (!virtqueue_get_buf(vq, &len))
+	if (!virtqueue_get_buf(vq, NULL))
 		return;
 	sg_init_one(&sg, vb->stats, sizeof(vb->stats[0]) * num_stats);
 	virtqueue_add_outbuf(vq, &sg, 1, vb, GFP_KERNEL);
@@ -586,10 +585,10 @@ static int send_cmd_id_start(struct virtio_balloon *vb)
 {
 	struct scatterlist sg;
 	struct virtqueue *vq = vb->free_page_vq;
-	int err, unused;
+	int err;
 
 	/* Detach all the used buffers from the vq */
-	while (virtqueue_get_buf(vq, &unused))
+	while (virtqueue_get_buf(vq, NULL))
 		;
 
 	vb->cmd_id_active = cpu_to_virtio32(vb->vdev,
@@ -605,10 +604,10 @@ static int send_cmd_id_stop(struct virtio_balloon *vb)
 {
 	struct scatterlist sg;
 	struct virtqueue *vq = vb->free_page_vq;
-	int err, unused;
+	int err;
 
 	/* Detach all the used buffers from the vq */
-	while (virtqueue_get_buf(vq, &unused))
+	while (virtqueue_get_buf(vq, NULL))
 		;
 
 	sg_init_one(&sg, &vb->cmd_id_stop, sizeof(vb->cmd_id_stop));
@@ -623,11 +622,11 @@ static int get_free_page_and_send(struct virtio_balloon *vb)
 	struct virtqueue *vq = vb->free_page_vq;
 	struct page *page;
 	struct scatterlist sg;
-	int err, unused;
+	int err;
 	void *p;
 
 	/* Detach all the used buffers from the vq */
-	while (virtqueue_get_buf(vq, &unused))
+	while (virtqueue_get_buf(vq, NULL))
 		;
 
 	page = alloc_pages(VIRTIO_BALLOON_FREE_PAGE_ALLOC_FLAG,
-- 
2.11.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ