- Oct 22, 2023
-
-
Hanna Czenczek authored
The VHOST_USER_PROTOCOL_F_XEN_MMAP feature bit was defined in f21e95ee, which has been part of qemu's 8.1.0 release. However, it seems it was never added to qemu's code, but it is well possible that it is already used by different front-ends outside of qemu (i.e., Xen). VHOST_USER_PROTOCOL_F_SHARED_OBJECT in contrast was added to qemu's code in 16094766, but never defined in the vhost-user specification. As a consequence, both bits were defined to be 17, which cannot work. Regardless of whether actual code or the specification should take precedence, F_XEN_MMAP is already part of a qemu release, while F_SHARED_OBJECT is not. Therefore, bump the latter to take number 18 instead of 17, and add this to the specification. Take the opportunity to add at least a little note on the VhostUserShared structure to the specification. This structure is referenced by the new commands introduced in 16094766, but was not defined. Fixes: 16094766 ("vhost-user: add shared_object msg") Signed-off-by:
Hanna Czenczek <hreitz@redhat.com> Message-Id: <20231016083201.23736-1-hreitz@redhat.com> Reviewed-by:
Emmanouil Pitsidianakis <manos.pitsidianakis@linaro.org> Reviewed-by:
Stefano Garzarella <sgarzare@redhat.com> Reviewed-by:
Viresh Kumar <viresh.kumar@linaro.org> Reviewed-by:
Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by:
Michael S. Tsirkin <mst@redhat.com> Signed-off-by:
Michael S. Tsirkin <mst@redhat.com>
-
- Oct 12, 2023
-
-
Thomas Huth authored
Rename shadowing variables to make this code compilable with -Wshadow=local. Signed-off-by:
Thomas Huth <thuth@redhat.com> Message-ID: <20231006121129.487251-1-thuth@redhat.com> Reviewed-by:
Michael S. Tsirkin <mst@redhat.com> Signed-off-by:
Markus Armbruster <armbru@redhat.com>
-
Thomas Huth authored
No need to declare a new variable with the same name here, we can simple re-use the one from the top of the function. With this change, the file now compiles fine with -Wshadow=local. Signed-off-by:
Thomas Huth <thuth@redhat.com> Message-ID: <20231006120819.480792-1-thuth@redhat.com> Reviewed-by:
Xie Yongji <xieyongji@bytedance.com> Signed-off-by:
Markus Armbruster <armbru@redhat.com>
-
- Oct 11, 2023
-
-
Pierre Labatut authored
Signed-off-by:
Pierre Labatut <plabatut@google.com> Signed-off-by:
Michael Tokarev <mjt@tls.msk.ru>
-
- Oct 04, 2023
-
-
Albert Esteve authored
In the libvhost-user library we need to handle VHOST_USER_GET_SHARED_OBJECT requests, and add helper functions to allow sending messages to interact with the virtio shared objects hash table. Signed-off-by:
Albert Esteve <aesteve@redhat.com> Message-Id: <20231002065706.94707-5-aesteve@redhat.com> Reviewed-by:
Michael S. Tsirkin <mst@redhat.com> Signed-off-by:
Michael S. Tsirkin <mst@redhat.com>
-
Vladimir Sementsov-Ogievskiy authored
Explain Coverity that we are not going to overflow vmsg->fds. Signed-off-by:
Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru> Message-Id: <20230925194040.68592-5-vsementsov@yandex-team.ru> Reviewed-by:
Michael S. Tsirkin <mst@redhat.com> Signed-off-by:
Michael S. Tsirkin <mst@redhat.com>
-
- Sep 21, 2023
-
-
Thomas Huth authored
This avoids the warnings à la: "warning: redirecting to https://gitlab.com/qemu-project/xyz.git/ " Signed-off-by:
Thomas Huth <thuth@redhat.com> Reviewed-by:
Michael Tokarev <mjt@tls.msk.ru> Reviewed-by:
Philippe Mathieu-Daudé <philmd@linaro.org> Signed-off-by:
Michael Tokarev <mjt@tls.msk.ru>
-
- Sep 07, 2023
-
-
Paolo Bonzini authored
This allows building libblkio at the same time as QEMU, if QEMU is configured with --enable-blkio --enable-download. Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
- Aug 31, 2023
-
-
Thomas Huth authored
Update the berkeley-testfloat-3 wrap to include a patch provided by Olaf Hering. This fixes a problem with "control reaches end of non-void function [-Werror=return-type]" compiler warning/errors that are now enabled by default in certain versions of GCC. Reported-by:
Olaf Hering <olaf@aepfle.de> Message-Id: <20230816091522.1292029-1-thuth@redhat.com> Signed-off-by:
Thomas Huth <thuth@redhat.com>
-
- Jun 26, 2023
-
-
Manos Pitsidianakis authored
Slave/master nomenclature was replaced with backend/frontend in commit 1fc19b65279a ("vhost-user: Adopt new backend naming") This patch replaces all remaining uses of master and slave in the codebase. Signed-off-by:
Emmanouil Pitsidianakis <manos.pitsidianakis@linaro.org> Message-Id: <20230613080849.2115347-1-manos.pitsidianakis@linaro.org> Reviewed-by:
Michael S. Tsirkin <mst@redhat.com> Signed-off-by:
Michael S. Tsirkin <mst@redhat.com> Reviewed-by:
Marc-André Lureau <marcandre.lureau@redhat.com>
-
- Jun 06, 2023
-
-
Paolo Bonzini authored
Unlike other subprojects, these require an overlay directory to include meson rules to build the libraries. The rules are basically lifted from tests/fp/meson.build, with a few changes to create platform.h and publish a dependency. The build defines are passed through a subproject option, and posted back to users of the library via the dependency's compile_args. The only remaining user of GIT_SUBMODULES and GIT_SUBMODULES_ACTION is roms/SLOF, which is used to build pc-bios/s390-ccw. All other roms submodules are only present to satisfy the license on pre-built firmware blobs. Best reviewed with --color-moved. Reviewed-by:
Daniel P. Berrangé <berrange@redhat.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Paolo Bonzini authored
Compared to submodules, .wrap files have several advantages: * option parsing and downloading is delegated to meson * the commit is stored in a text file instead of a magic entry in the git tree object * we could stop shipping external dependencies that are only used as a fallback, but not break compilation on platforms that lack them. For example it may make sense to download dtc at build time, controlled by --enable-download, even when building from a tarball. Right now, this patch does the opposite: make-release treats dtc like libvfio-user (which is not stable API and therefore hasn't found its way into any distros) and keycodemap (which is a copylib, for better or worse). dependency() can fall back to a wrap automatically. However, this is only possible for libraries that come with a .pc file, and this is not very common for libfdt even though the upstream project in principle provides it; it also removes the control that we provide with --enable-fdt={system,internal}. Therefore, the logic to pick system vs. internal libfdt is left untouched. --enable-fdt=git is removed; it was already a synonym for --enable-fdt=internal. Reviewed-by:
Daniel P. Berrangé <berrange@redhat.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Paolo Bonzini authored
The behavior of --{enable,disable}-pypi is similar to that of -Dwrapmode={default,nodownload} respectively. In particular, in both cases a feature needs to be explicitly enabled for the dependency to be downloaded. So, use a single option to control both cases. Now, --enable-slirp will trigger cloning and building of libslirp if the .pc file is not found on the machine. Reviewed-by:
Daniel P. Berrangé <berrange@redhat.com> Reviewed-by:
Thomas Huth <thuth@redhat.com> Reviewed-by:
Alex Bennée <alex.bennee@linaro.org> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
- May 26, 2023
-
-
Paolo Bonzini authored
By using a subproject, our own meson.build can use variables from the subproject instead of hard-coded paths. This is also the first step towards managing downloads with .wrap files instead of submodule. Reviewed-by:
Daniel P. Berrangé <berrange@redhat.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Paolo Bonzini authored
Recent dtc/libfdt can use either Make or meson as the build system. By using a subproject, our own meson.build can remove the hard coded list of source files. This is also the first step towards managing downloads with .wrap files instead of submodule. Reviewed-by:
Daniel P. Berrangé <berrange@redhat.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Paolo Bonzini authored
It is recommended to use SSIZE_T for ssize_t on win32, but the commit that is being used for slirp.wrap uses int. Update to include the fix as well as the other bugfix commit "ip: Enforce strict aliasing". Reported-by:
Michael Tokarev <mjt@tls.msk.ru> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
- Apr 28, 2023
-
-
David 'Digit' Turner authored
The source file uses VIRTIO_F_VERSION_1 which is not defined by <linux/virtio_config.h> on Debian 10. The system-provided <linux/virtio_config.h> which does not include the macro definition is included through <linux/vhost.h>, so fix the issue by including the standard-headers version before that. Signed-off-by:
David 'Digit' Turner <digit@google.com> Message-Id: <20230405125920.2951721-2-digit@google.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
- Apr 21, 2023
-
-
Vladimir Sementsov-Ogievskiy authored
Currently block_resize qmp command is simply ignored by vhost-user-blk export. So, the block-node is successfully resized, but virtio config is unchanged and guest doesn't see that disk is resized. Let's handle the resize by modifying the config and notifying the guest appropriately. After this comment, lsblk in linux guest with attached vhost-user-blk-pci device shows new size immediately after block_resize QMP command on vhost-user exported block node. Signed-off-by:
Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru> Message-Id: <20230321201323.3695923-1-vsementsov@yandex-team.ru> Reviewed-by:
Michael S. Tsirkin <mst@redhat.com> Signed-off-by:
Michael S. Tsirkin <mst@redhat.com>
-
- Apr 20, 2023
-
-
Marc-André Lureau authored
This allows to build with --enable-slirp / -D slirp=enabled, even when libslirp is not installed on the system. "meson subprojects download" will pull it from git in that case. Signed-off-by:
Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20230302131848.1527460-4-marcandre.lureau@redhat.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
- Mar 03, 2023
-
-
Carlos López authored
Check the return value for malloc(), avoiding a NULL pointer dereference, and propagate error in function callers. Found with GCC 13 and -fanalyzer: ../subprojects/libvhost-user/libvhost-user.c: In function ‘virtqueue_alloc_element’: ../subprojects/libvhost-user/libvhost-user.c:2556:19: error: dereference of possibly-NULL ‘elem’ [CWE-690] [-Werror=analyzer-possible-null-dereference] 2556 | elem->out_num = out_num; | ~~~~~~~~~~~~~~^~~~~~~~~ ‘virtqueue_alloc_element’: event 1 | | 2554 | assert(sz >= sizeof(VuVirtqElement)); | | ^~~~~~ | | | | | (1) following ‘true’ branch (when ‘sz > 31’)... | ‘virtqueue_alloc_element’: events 2-4 | | 2555 | elem = malloc(out_sg_end); | | ^~~~ ~~~~~~~~~~~~~~~~~~ | | | | | | | (3) this call could return NULL | | (2) ...to here | 2556 | elem->out_num = out_num; | | ~~~~~~~~~~~~~~~~~~~~~~~ | | | | | (4) ‘elem’ could be NULL: unchecked value from (3) | Signed-off-by:
Carlos López <clopez@suse.de> Message-Id: <20230210112514.16858-1-clopez@suse.de> Reviewed-by:
Michael S. Tsirkin <mst@redhat.com> Signed-off-by:
Michael S. Tsirkin <mst@redhat.com>
-
- Mar 02, 2023
-
-
Maxime Coquelin authored
The Vhost-user specification changed feature and request naming from _SLAVE_ to _BACKEND_. This patch adopts the new naming convention. Signed-off-by:
Maxime Coquelin <maxime.coquelin@redhat.com> Message-Id: <20230208203259.381326-3-maxime.coquelin@redhat.com> Reviewed-by:
Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by:
Michael S. Tsirkin <mst@redhat.com> Signed-off-by:
Michael S. Tsirkin <mst@redhat.com>
-
- Jan 11, 2023
-
-
Marcel Holtmann authored
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>
-
Marcel Holtmann authored
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>
-
Marcel Holtmann authored
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>
-
Marcel Holtmann authored
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>
-
Marcel Holtmann authored
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>
-
Marcel Holtmann authored
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>
-
Marcel Holtmann authored
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>
-
Marcel Holtmann authored
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>
-
Marcel Holtmann authored
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>
-
Marcel Holtmann authored
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>
-
Marcel Holtmann authored
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>
-
Marcel Holtmann authored
Then the libvhost-user 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 libvhost-user.o libvhost-user.c: In function ‘vu_panic’: libvhost-user.c:195:9: error: implicit declaration of function ‘vasprintf’; did you mean ‘vsprintf’? [-Werror=implicit-function-declaration] 195 | if (vasprintf(&buf, msg, ap) < 0) { | ^~~~~~~~~ | vsprintf The simplest way to allow external complication of libvhost-user.[ch] is by setting _GNU_SOURCE if it is not already set by the build system. Signed-off-by:
Marcel Holtmann <marcel@holtmann.org> Message-Id: <be27dcc747a6b5cc6f8ae3f79e0b79171382bcef.1671741278.git.marcel@holtmann.org> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
- Dec 21, 2022
-
-
Marcel Holtmann authored
It seems there is no need to keep the inuse field signed and end up with compiler warnings for sign-compare. CC libvhost-user.o libvhost-user.c: In function ‘vu_queue_pop’: libvhost-user.c:2763:19: error: comparison of integer expressions of different signedness: ‘int’ and ‘unsigned int’ [-Werror=sign-compare] 2763 | if (vq->inuse >= vq->vring.num) { | ^~ libvhost-user.c: In function ‘vu_queue_rewind’: libvhost-user.c:2808:13: error: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Werror=sign-compare] 2808 | if (num > vq->inuse) { | ^ Instead of casting the comparision to unsigned int, just make the inuse field unsigned int in the fist place. Signed-off-by:
Marcel Holtmann <marcel@holtmann.org> Message-Id: <20221219175337.377435-8-marcel@holtmann.org> Reviewed-by:
Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by:
Michael S. Tsirkin <mst@redhat.com> Signed-off-by:
Michael S. Tsirkin <mst@redhat.com>
-
- Nov 27, 2022
-
-
Stefan Weil authored
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>
-
Stefan Weil authored
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>
-
Stefan Weil authored
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>
-
Stefan Weil authored
Reviewed-by:
Philippe Mathieu-Daudé <f4bug@amsat.org> Signed-off-by:
Stefan Weil <sw@weilnetz.de> Message-Id: <20220422070144.1043697-2-sw@weilnetz.de> Signed-off-by:
Laurent Vivier <laurent@vivier.eu> Signed-off-by:
Stefan Hajnoczi <stefanha@redhat.com> Message-Id: <20221126152507.283271-2-sw@weilnetz.de>
-
- Nov 12, 2022
-
-
Philippe Mathieu-Daudé authored
GCC 8 added a -Wstringop-truncation warning: The -Wstringop-truncation warning added in GCC 8.0 via r254630 for bug 81117 is specifically intended to highlight likely unintended uses of the strncpy function that truncate the terminating NUL character from the source string. Here the next line indeed unconditionally zeroes the last byte, but 1/ the buffer has been calloc'd, so we don't need to add an extra byte, and 2/ we called vduse_name_is_invalid() which checked the string length, so we can simply call strcpy(). This fixes when using gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0: [42/666] Compiling C object subprojects/libvduse/libvduse.a.p/libvduse.c.o FAILED: subprojects/libvduse/libvduse.a.p/libvduse.c.o cc -m64 -mcx16 -Isubprojects/libvduse/libvduse.a.p -Isubprojects/libvduse -I../../subprojects/libvduse [...] -o subprojects/libvduse/libvduse.a.p/libvduse.c.o -c ../../subprojects/libvduse/libvduse.c In file included from /usr/include/string.h:495, from ../../subprojects/libvduse/libvduse.c:24: In function ‘strncpy’, inlined from ‘vduse_dev_create’ at ../../subprojects/libvduse/libvduse.c:1312:5: /usr/include/x86_64-linux-gnu/bits/string_fortified.h:106:10: error: ‘__builtin_strncpy’ specified bound 256 equals destination size [-Werror=stringop-truncation] 106 | return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest)); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ cc1: all warnings being treated as errors ninja: build stopped: cannot make progress due to previous errors. Fixes: d9cf16c0 ("libvduse: Replace strcpy() with strncpy()") Suggested-by:
Markus Armbruster <armbru@redhat.com> Signed-off-by:
Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by:
Xie Yongji <xieyongji@bytedance.com> Reviewed-by:
Stefan Hajnoczi <stefanha@redhat.com> Tested-by:
Bin Meng <bmeng@tinylab.org> Signed-off-by:
Stefan Hajnoczi <stefanha@redhat.com> Message-Id: <20221111124550.35753-1-philmd@linaro.org>
-
- Aug 02, 2022
-
-
Xie Yongji authored
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>
-