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: <20230308141737.ioxvifnarhluafmh@sgarzare-redhat>
Date:   Wed, 8 Mar 2023 15:17:37 +0100
From:   Stefano Garzarella <sgarzare@...hat.com>
To:     Rong Tao <rtoax@...mail.com>
Cc:     mst@...hat.com, Rong Tao <rongtao@...tc.cn>,
        Jason Wang <jasowang@...hat.com>,
        "open list:VIRTIO CORE AND NET DRIVERS" 
        <virtualization@...ts.linux-foundation.org>,
        open list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] tools/virtio: virtio_test -h,--help should return
 directly

On Fri, Feb 24, 2023 at 10:30:30PM +0800, Rong Tao wrote:
>From: Rong Tao <rongtao@...tc.cn>
>
>When we get help information, we should return directly, and we should not
>execute test cases. At the same time, the code indentation issue was fixed
>and virtio-trace/trace-agent was added to .gitignore.

Thanks for this cleanup, but you mentioned 3 independent things that
this patch does, so it would be better to split it into 3 separate
patches.

>
>Signed-off-by: Rong Tao <rongtao@...tc.cn>
>---
> tools/virtio/.gitignore    | 1 +
> tools/virtio/virtio_test.c | 6 +++---
> 2 files changed, 4 insertions(+), 3 deletions(-)
>
>diff --git a/tools/virtio/.gitignore b/tools/virtio/.gitignore
>index 075588c4da08..9934d48d9a55 100644
>--- a/tools/virtio/.gitignore
>+++ b/tools/virtio/.gitignore
>@@ -2,3 +2,4 @@
> *.d
> virtio_test
> vringh_test
>+virtio-trace/trace-agent
>diff --git a/tools/virtio/virtio_test.c b/tools/virtio/virtio_test.c
>index 120062f94590..6370cdada396 100644
>--- a/tools/virtio/virtio_test.c
>+++ b/tools/virtio/virtio_test.c
>@@ -134,7 +134,7 @@ static void vdev_info_init(struct vdev_info* dev, unsigned long long features)
> 	dev->buf_size = 1024;
> 	dev->buf = malloc(dev->buf_size);
> 	assert(dev->buf);
>-        dev->control = open("/dev/vhost-test", O_RDWR);
>+	dev->control = open("/dev/vhost-test", O_RDWR);
> 	assert(dev->control >= 0);
> 	r = ioctl(dev->control, VHOST_SET_OWNER, NULL);
> 	assert(r >= 0);
>@@ -142,7 +142,7 @@ static void vdev_info_init(struct vdev_info* dev, unsigned long long features)
> 			  sizeof dev->mem->regions[0]);
> 	assert(dev->mem);
> 	memset(dev->mem, 0, offsetof(struct vhost_memory, regions) +
>-                          sizeof dev->mem->regions[0]);
>+			sizeof dev->mem->regions[0]);

This did not seem to me to be an indentation issue, there are 2 tabs and
1 space to line it up with the opening of the parenthesis of the line
above.

> 	dev->mem->nregions = 1;
> 	dev->mem->regions[0].guest_phys_addr = (long)dev->buf;
> 	dev->mem->regions[0].userspace_addr = (long)dev->buf;
>@@ -361,7 +361,7 @@ int main(int argc, char **argv)
> 			break;
> 		case 'h':
> 			help();
>-			goto done;
>+			exit(0);

Maybe we can move the exit() directly into the help() function and 
remove it from case '?'.

I would return a value different from 0 (like in the case '?').

Thanks,
Stefano

> 		case 'i':
> 			features &= ~(1ULL << VIRTIO_RING_F_INDIRECT_DESC);
> 			break;
>-- 
>2.39.2
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ