[Qemu-devel] [PATCH] libvhost-user: fix SLAVE_SEND_FD handling

Johannes Berg posted 1 patch 6 years, 2 months ago
Test docker-clang@ubuntu passed
Test FreeBSD passed
Test checkpatch failed
Test docker-mingw@fedora passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20190903195442.11199-1-johannes@sipsolutions.net
There is a newer version of this series
contrib/libvhost-user/libvhost-user.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
[Qemu-devel] [PATCH] libvhost-user: fix SLAVE_SEND_FD handling
Posted by Johannes Berg 6 years, 2 months ago
From: Johannes Berg <johannes.berg@intel.com>

It doesn't look like this could possibly work properly since
VHOST_USER_PROTOCOL_F_SLAVE_SEND_FD is defined to 10, but the
dev->protocol_features has a bitmap. I suppose the peer this
was tested with also supported VHOST_USER_PROTOCOL_F_LOG_SHMFD,
in which case the test would always be false, but nevertheless
the code seems wrong.

Use has_feature() to fix this.

Fixes: d84599f56c82 ("libvhost-user: support host notifier")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
 contrib/libvhost-user/libvhost-user.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/contrib/libvhost-user/libvhost-user.c b/contrib/libvhost-user/libvhost-user.c
index 6a02eaffc672..e250e69abec9 100644
--- a/contrib/libvhost-user/libvhost-user.c
+++ b/contrib/libvhost-user/libvhost-user.c
@@ -1097,7 +1097,8 @@ bool vu_set_queue_host_notifier(VuDev *dev, VuVirtq *vq, int fd,
 
     vmsg.fd_num = fd_num;
 
-    if ((dev->protocol_features & VHOST_USER_PROTOCOL_F_SLAVE_SEND_FD) == 0) {
+    if (!has_feature(dev->protocol_features,
+		     VHOST_USER_PROTOCOL_F_SLAVE_SEND_FD)) {
         return false;
     }
 
-- 
2.23.0


Re: [Qemu-devel] [PATCH] libvhost-user: fix SLAVE_SEND_FD handling
Posted by no-reply@patchew.org 6 years, 2 months ago
Patchew URL: https://patchew.org/QEMU/20190903195442.11199-1-johannes@sipsolutions.net/



Hi,

This series seems to have some coding style problems. See output below for
more information:

Type: series
Message-id: 20190903195442.11199-1-johannes@sipsolutions.net
Subject: [Qemu-devel] [PATCH] libvhost-user: fix SLAVE_SEND_FD handling

=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram
./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
Switched to a new branch 'test'
9da584f libvhost-user: fix SLAVE_SEND_FD handling

=== OUTPUT BEGIN ===
ERROR: code indent should never use tabs
#30: FILE: contrib/libvhost-user/libvhost-user.c:1101:
+^I^I     VHOST_USER_PROTOCOL_F_SLAVE_SEND_FD)) {$

total: 1 errors, 0 warnings, 9 lines checked

Commit 9da584f52360 (libvhost-user: fix SLAVE_SEND_FD handling) has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
=== OUTPUT END ===

Test command exited with code: 1


The full log is available at
http://patchew.org/logs/20190903195442.11199-1-johannes@sipsolutions.net/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to patchew-devel@redhat.com