Skip to contentSkip to conversation

libvhost-user: fix SLAVE_SEND_FD handling

PATCH Superseded Johannes Berg 2 participants 2 messages Sep 3, 2019

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libvhost-user: fix SLAVE_SEND_FD handling

From: Johannes Berg <[email protected]>

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")
---
 contrib/libvhost-user/libvhost-user.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
contrib/libvhost-user/libvhost-user.c +2 -1
index 6a02eaffc672..e250e69abec9 100644
@@ -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;
     }
 
Signature · 1 line
2.23.0
#1 lore raw
Patchew URL: https://patchew.org/QEMU/[email protected]/

Patchew URL: https://patchew.org/QEMU/[email protected]/

Hi,

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

Type: series
Message-id: [email protected]
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/[email protected]/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to [email protected]