[nbdkit PATCH] rust: prevent dead_code warning
by Thomas Weißschuh
rustc 1.64.0 generates warnings for the mocked Server.
This leads to a failure of test.sh.
```
warning: associated function `expect` is never used
--> tests/common/mod.rs:49:1
|
49 | / mock!{
50 | | pub Server {}
51 | | impl Server for Server {
52 | | fn cache(&self, count: u32, offset: u64) -> Result<()>;
... |
86 | | }
87 | | }
| |_^
|
= note: `#[warn(dead_code)]` on by default
```
---
Note: This also affects the maintenance branches.
plugins/rust/tests/common/mod.rs | 1 +
1 file changed, 1 insertion(+)
diff --git a/plugins/rust/tests/common/mod.rs b/plugins/rust/tests/common/mod.rs
index 61c30464..de26c89f 100644
--- a/plugins/rust/tests/common/mod.rs
+++ b/plugins/rust/tests/common/mod.rs
@@ -48,6 +48,7 @@ lazy_static! {
mock!{
pub Server {}
+ #[allow(dead_code)]
impl Server for Server {
fn cache(&self, count: u32, offset: u64) -> Result<()>;
fn can_cache(&self) -> Result<CacheFlags>;
base-commit: 20c2dc98b6bbde2f92e63d500d5e6015184bb105
--
2.38.0
2 years, 2 months
bug in gnutls_init()
by Eric Blake
I just fixed a bug in nbdkit for incorrectly calling
free(gnutls_session_t) after gnutls_init(&session, ...) fails:
https://gitlab.com/nbdkit/nbdkit/-/commit/40faf3dfb20c06b9c5faa0a122607e3...
But in the process, I was browsing the source code to gnutls_init() to
see why Coverity wasn't flagging free(opaque_type) as fishy, and found
that there is a nasty lurking bug:
int gnutls_init(gnutls_session_t * session, unsigned int flags)
{
int ret;
FAIL_IF_LIB_ERROR;
*session = gnutls_calloc(1, sizeof(struct gnutls_session_int));
Note that *session is left uninitialized if FAIL_IF_LIB_ERROR; causes
an early return GNUTLS_E_LIB_IN_ERROR_STATE. If a caller (properly)
treats gnutls_session_t as an opaque type, and does not try to
zero-initialize it (as there is no way to know that 0 is a safe value
for an opaque type), then writing:
gnutls_session_t session;
int err = gnutls_init (&session, GNUTLS_SERVER);
if (err < 0)
gnutls_deinit (session);
is a bug waiting to happen, because it WILL cause gnutls_deinit() to
attempt to dereference an uninitialized pointer if session remains
uninitialized because of an earlier library error.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
2 years, 2 months
[libnbd PATCH 0/2] Expose tls and structured_reply in nbdinfo
by Eric Blake
Indirectly related to my recent additions of nbd_opt_starttls() and
nbd_opt_structured_reply(); also a precursor to further extending this
part of nbdinfo to expose when 64-bit extensions are negotiated.
Eric Blake (2):
info: Expose whether structured replies were negotiated
info: Add --is tls, --can structured-reply
info/nbdinfo.pod | 37 ++++++++++++++++++++++++++-----------
info/Makefile.am | 3 ++-
info/can.c | 15 ++++++++++++++-
info/info-can-connect.sh | 9 ++++++++-
info/info-can.sh | 35 ++++++++++++++++++++++++++++++++---
info/info-packets.sh | 38 ++++++++++++++++++++++++++++++++++++++
info/info-uri-nbds.sh | 5 +++--
info/main.c | 7 +++++++
8 files changed, 130 insertions(+), 19 deletions(-)
create mode 100755 info/info-packets.sh
--
2.37.3
2 years, 2 months