8d5666d7 | 22-Dec-2022 |
Marcel Holtmann <marcel@holtmann.org> |
libvduse: Add extra compiler warnings
In case libvhost-user is used externally, that projects compiler warnings might be more strict. Enforce an extra set of compiler warnings to catch issues early
libvduse: Add extra compiler warnings
In case libvhost-user is used externally, that projects compiler warnings might be more strict. Enforce an extra set of compiler warnings to catch issues early on.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Suggested-by: Paolo Bonzini <pbonzini@redhat.com> Message-Id: <08daa1896ad8824e17d57d6a970bc0b4bee73ece.1671741278.git.marcel@holtmann.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
722b62d9 | 22-Dec-2022 |
Marcel Holtmann <marcel@holtmann.org> |
libvhost-user: Add extra compiler warnings
In case libvhost-user is used externally, that projects compiler warnings might be more strict. Enforce an extra set of compiler warnings to catch issues e
libvhost-user: Add extra compiler warnings
In case libvhost-user is used externally, that projects compiler warnings might be more strict. Enforce an extra set of compiler warnings to catch issues early on.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Suggested-by: Paolo Bonzini <pbonzini@redhat.com> Message-Id: <737ebf2e697f8640558e6f73d96a692711f548f6.1671741278.git.marcel@holtmann.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
950a2f2e | 22-Dec-2022 |
Marcel Holtmann <marcel@holtmann.org> |
libvhost-user: Fix assignment in vring_set_avail_event
Since it was proposed to change the code in libvduse.c to use memcpy instead of an assignment, the code in libvhost-user.c should also be chang
libvhost-user: Fix assignment in vring_set_avail_event
Since it was proposed to change the code in libvduse.c to use memcpy instead of an assignment, the code in libvhost-user.c should also be changed to use memcpy.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Suggested-by: Paolo Bonzini <pbonzini@redhat.com> Message-Id: <502b22723264db064e4b05008233a9c1f2f8aaaa.1671741278.git.marcel@holtmann.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
86e61e42 | 22-Dec-2022 |
Marcel Holtmann <marcel@holtmann.org> |
libvduse: Fix assignment in vring_set_avail_event
Since the assignment is causing a compiler warning, fix it by using memcpy instead.
CC libvduse.o libvduse.c: In function ‘vring_set_avail_
libvduse: Fix assignment in vring_set_avail_event
Since the assignment is causing a compiler warning, fix it by using memcpy instead.
CC libvduse.o libvduse.c: In function ‘vring_set_avail_event’: libvduse.c:603:7: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasin] 603 | *((uint16_t *)&vq->vring.used->ring[vq->vring.num]) = htole16(val); | ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Suggested-by: Xie Yongji <xieyongji@bytedance.com> Suggested-by: Paolo Bonzini <pbonzini@redhat.com> Message-Id: <4a0fe2a6436464473119fdbf0bc4076b36fbb37f.1671741278.git.marcel@holtmann.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
85899f8e | 22-Dec-2022 |
Marcel Holtmann <marcel@holtmann.org> |
libvduse: Switch to unsigned int for inuse field in struct VduseVirtq
It seems there is no need to keep the inuse field signed and end up with compiler warnings for sign-compare.
CC libvdus
libvduse: Switch to unsigned int for inuse field in struct VduseVirtq
It seems there is no need to keep the inuse field signed and end up with compiler warnings for sign-compare.
CC libvduse.o libvduse.c: In function ‘vduse_queue_pop’: libvduse.c:789:19: error: comparison of integer expressions of different signedness: ‘int’ and ‘unsigned int’ [-Werror=sign-compare] 789 | if (vq->inuse >= vq->vring.num) { | ^~
Instead of casting the comparison to unsigned int, just make the inuse field unsigned int in the fist place.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Reviewed-by: Xie Yongji <xieyongji@bytedance.com> Message-Id: <9fe3fd8b042e048bd04d506ca6e43d738b5c45b7.1671741278.git.marcel@holtmann.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
518ac428 | 22-Dec-2022 |
Marcel Holtmann <marcel@holtmann.org> |
libvduse: Provide _GNU_SOURCE when compiling outside of QEMU
When the libvduse sources are used by another project, it can not be guaranteed that _GNU_SOURCE is set by the build system. If it is for
libvduse: Provide _GNU_SOURCE when compiling outside of QEMU
When the libvduse sources are used by another project, it can not be guaranteed that _GNU_SOURCE is set by the build system. If it is for example not set, errors like this show up.
CC libvduse.o libvduse.c: In function ‘vduse_log_get’: libvduse.c:172:9: error: implicit declaration of function ‘ftruncate’; did you mean ‘strncat’? [-Werror=implicit-function-declaration] 172 | if (ftruncate(fd, size) == -1) { | ^~~~~~~~~ | strncat
The simplest way to allow external complication of libvduse.[ch] by setting _GNU_SOURCE if it is not already set by the build system.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Message-Id: <407f3665f0605df936e5bfe60831d180edfb8cca.1671741278.git.marcel@holtmann.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
f1c563d2 | 22-Dec-2022 |
Marcel Holtmann <marcel@holtmann.org> |
libvhost-user: Change dev->postcopy_ufd assignment to make it C90 compliant
The assignment of dev->postcopy_ufd can be moved into an else clause and then the code becomes C90 compliant.
CC
libvhost-user: Change dev->postcopy_ufd assignment to make it C90 compliant
The assignment of dev->postcopy_ufd can be moved into an else clause and then the code becomes C90 compliant.
CC libvhost-user.o libvhost-user.c: In function ‘vu_set_postcopy_advise’: libvhost-user.c:1625:5: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement] 1625 | struct uffdio_api api_struct; | ^~~~~~
Understandable, it might be desired to avoid else clauses, but in this case it seems clear enough and frankly the dev->postcopy_ufd is only assigned once.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-Id: <74db52afb1203c4580ffc7fa462b4b2ba260a353.1671741278.git.marcel@holtmann.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
d87a6424 | 22-Dec-2022 |
Marcel Holtmann <marcel@holtmann.org> |
libvhost-user: Declare uffdio_register early to make it C90 compliant
When using libvhost-user source in an external project that wants to comply with the C90 standard, it is best to declare variabl
libvhost-user: Declare uffdio_register early to make it C90 compliant
When using libvhost-user source in an external project that wants to comply with the C90 standard, it is best to declare variables before code.
CC libvhost-user.o libvhost-user.c: In function ‘generate_faults’: libvhost-user.c:683:9: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement] 683 | struct uffdio_register reg_struct; | ^~~~~~
In this case, it is also simple enough and doesn't cause any extra ifdef additions.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-Id: <556c2d00c01fa134d13c0371d4014c90694c2943.1671741278.git.marcel@holtmann.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
92bf2461 | 22-Dec-2022 |
Marcel Holtmann <marcel@holtmann.org> |
libvhost-user: Use unsigned int i for some for-loop iterations
The sign-compare warning also hits some of the for-loops, but it easy fixed by just making the iterator variable unsigned int.
CC
libvhost-user: Use unsigned int i for some for-loop iterations
The sign-compare warning also hits some of the for-loops, but it easy fixed by just making the iterator variable unsigned int.
CC libvhost-user.o libvhost-user.c: In function ‘vu_gpa_to_va’: libvhost-user.c:223:19: error: comparison of integer expressions of different signedness: ‘int’ and ‘uint32_t’ {aka ‘unsigned int’} [-Werror=sign-compare] 223 | for (i = 0; i < dev->nregions; i++) { | ^
Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Message-Id: <decb925e1a6fb9538738d2570bda2804f888fa15.1671741278.git.marcel@holtmann.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
18fa7f1e | 22-Dec-2022 |
Marcel Holtmann <marcel@holtmann.org> |
libvhost-user: Cast rc variable to avoid compiler warning
The assert from recvmsg() return value against an uint32_t size field from a protocol struct throws a compiler warning.
CC libvhost
libvhost-user: Cast rc variable to avoid compiler warning
The assert from recvmsg() return value against an uint32_t size field from a protocol struct throws a compiler warning.
CC libvhost-user.o In file included from libvhost-user.c:27: libvhost-user.c: In function ‘vu_message_read_default’: libvhost-user.c:363:19: error: comparison of integer expressions of different signedness: ‘int’ and ‘uint32_t’ {aka ‘unsigned int’} [-Werror=sign-compare] 363 | assert(rc == vmsg->size); | ^~
This is not critical, but annoying when the libvhost-user source are used in an external project that has this compiler warning switched on.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Message-Id: <7a791e27b7bd3e0a8b8cc8fbb15090a870d226d5.1671741278.git.marcel@holtmann.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
aa5d395a | 22-Dec-2022 |
Marcel Holtmann <marcel@holtmann.org> |
libvhost-user: Replace typeof with __typeof__
Strictly speaking only -std=gnu99 support the usage of typeof and for easier inclusion in external projects, it is better to use __typeof__.
CC
libvhost-user: Replace typeof with __typeof__
Strictly speaking only -std=gnu99 support the usage of typeof and for easier inclusion in external projects, it is better to use __typeof__.
CC libvhost-user.o libvhost-user.c: In function ‘vu_log_queue_fill’: libvhost-user.c:86:13: error: implicit declaration of function ‘typeof’ [-Werror=implicit-function-declaration] 86 | typeof(x) _min1 = (x); \ | ^~~~~~
Changing these two users of typeof makes the compiler happy and no extra flags or pragmas need to be provided.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-Id: <981aa822bcaaa2b8d74f245339a99a85c25b346f.1671741278.git.marcel@holtmann.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
52a57d8d | 26-Nov-2022 |
Stefan Weil via <qemu-devel@nongnu.org> |
libvhost-user: Add format attribute to local function vu_panic
Signed-off-by: Stefan Weil <sw@weilnetz.de> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20220422070144.10
libvhost-user: Add format attribute to local function vu_panic
Signed-off-by: Stefan Weil <sw@weilnetz.de> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20220422070144.1043697-4-sw@weilnetz.de> Signed-off-by: Laurent Vivier <laurent@vivier.eu> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Message-Id: <20221126152507.283271-5-sw@weilnetz.de>
show more ...
|
7d4774e6 | 26-Nov-2022 |
Stefan Weil via <qemu-devel@nongnu.org> |
libvhost-user: Fix two more format strings
This fix is required for 32 bit hosts. The bug was detected by CI for arm-linux, but is also relevant for i386-linux.
Reported-by: Stefan Hajnoczi <stefan
libvhost-user: Fix two more format strings
This fix is required for 32 bit hosts. The bug was detected by CI for arm-linux, but is also relevant for i386-linux.
Reported-by: Stefan Hajnoczi <stefanha@gmail.com> Signed-off-by: Stefan Weil <sw@weilnetz.de> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Message-Id: <20221126152507.283271-4-sw@weilnetz.de>
show more ...
|
8541bf45 | 26-Nov-2022 |
Stefan Weil via <qemu-devel@nongnu.org> |
libvhost-user: Fix format strings
Signed-off-by: Stefan Weil <sw@weilnetz.de> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20220422070144.1043697-3-sw@weilnetz.de> Signe
libvhost-user: Fix format strings
Signed-off-by: Stefan Weil <sw@weilnetz.de> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20220422070144.1043697-3-sw@weilnetz.de> Signed-off-by: Laurent Vivier <laurent@vivier.eu> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Message-Id: <20221126152507.283271-3-sw@weilnetz.de>
show more ...
|
630179b7 | 06-Jul-2022 |
Xie Yongji <xieyongji@bytedance.com> |
libvduse: Pass positive value to strerror()
The value passed to strerror() should be positive. So let's fix it.
Fixes: Coverity CID 1490226, 1490223 Signed-off-by: Xie Yongji <xieyongji@bytedance.c
libvduse: Pass positive value to strerror()
The value passed to strerror() should be positive. So let's fix it.
Fixes: Coverity CID 1490226, 1490223 Signed-off-by: Xie Yongji <xieyongji@bytedance.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20220706095624.328-4-xieyongji@bytedance.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
show more ...
|
d9cf16c0 | 06-Jul-2022 |
Xie Yongji <xieyongji@bytedance.com> |
libvduse: Replace strcpy() with strncpy()
Coverity reported a string overflow issue since we copied "name" to "dev_config->name" without checking the length. This should be a false positive since we
libvduse: Replace strcpy() with strncpy()
Coverity reported a string overflow issue since we copied "name" to "dev_config->name" without checking the length. This should be a false positive since we already checked the length of "name" in vduse_name_is_invalid(). But anyway, let's replace strcpy() with strncpy() (as a general library, we'd like to minimize dependencies on other libraries, so we didn't use g_strlcpy() here) to fix the coverity complaint.
Fixes: Coverity CID 1490224 Signed-off-by: Xie Yongji <xieyongji@bytedance.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20220706095624.328-3-xieyongji@bytedance.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
show more ...
|
7f27d20d | 27-Jun-2022 |
Kevin Wolf <kwolf@redhat.com> |
libvhost-user: Fix VHOST_USER_ADD_MEM_REG reply
With REPLY_NEEDED, libvhost-user sends both the acutal result and an additional ACK reply for VHOST_USER_ADD_MEM_REG. This is incorrect, the spec mand
libvhost-user: Fix VHOST_USER_ADD_MEM_REG reply
With REPLY_NEEDED, libvhost-user sends both the acutal result and an additional ACK reply for VHOST_USER_ADD_MEM_REG. This is incorrect, the spec mandates that it behave the same with and without REPLY_NEEDED because it always sends a reply.
Fixes: ec94c8e621de96c50c2d381c8c9ec94f5beec7c1 Signed-off-by: Kevin Wolf <kwolf@redhat.com> Message-Id: <20220627134500.94842-4-kwolf@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
show more ...
|