git: 164597439270 - main - ctld: Add missing initializers for several class members
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 02 Sep 2025 18:40:53 UTC
The branch main has been updated by jhb:
URL: https://cgit.FreeBSD.org/src/commit/?id=16459743927068abbee34ce3f266b38c71968232
commit 16459743927068abbee34ce3f266b38c71968232
Author: John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2025-09-02 18:40:30 +0000
Commit: John Baldwin <jhb@FreeBSD.org>
CommitDate: 2025-09-02 18:40:30 +0000
ctld: Add missing initializers for several class members
These fields all need to be explicitly initialized with zeroes. Prior
to the conversion to C++ these fields were zeroed by calloc().
This worked for me in earlier testing as my test boxes had
MALLOC_PRODUCTION enabled in make.conf.
PR: 289115
Reported by: Slawa Olhovchenkov <slw zxy.spb.ru>
Fixes: eb0dc901a541 ("ctld: Convert struct auth_group to a C++ class")
Fixes: 6acc7afa34aa ("ctld: Convert struct port to a hierarchy of C++ classes")
Fixes: 2bb9180bb5d0 ("ctld: Convert struct target to a C++ class")
Fixes: ed076901ec80 ("ctld: Convert struct ctld_connection to a C++ class")
Sponsored by: Chelsio Communications
---
usr.sbin/ctld/ctld.hh | 6 +++---
usr.sbin/ctld/iscsi.hh | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/usr.sbin/ctld/ctld.hh b/usr.sbin/ctld/ctld.hh
index bfe4507bb3e6..cc88e6eb590e 100644
--- a/usr.sbin/ctld/ctld.hh
+++ b/usr.sbin/ctld/ctld.hh
@@ -425,7 +425,7 @@ protected:
virtual struct portal_group *default_portal_group() = 0;
struct conf *t_conf;
- std::array<struct lun *, MAX_LUNS> t_luns;
+ std::array<struct lun *, MAX_LUNS> t_luns = {};
auth_group_sp t_auth_group;
std::list<port *> t_ports;
std::string t_name;
@@ -434,7 +434,7 @@ protected:
std::string t_redirection;
/* Name of this target's physical port, if any, i.e. "isp0" */
std::string t_pport;
- bool t_private_auth;
+ bool t_private_auth = false;
};
using target_up = std::unique_ptr<target>;
@@ -575,7 +575,7 @@ struct pport {
private:
std::string pp_name;
uint32_t pp_ctl_port;
- bool pp_linked;
+ bool pp_linked = false;
};
struct kports {
diff --git a/usr.sbin/ctld/iscsi.hh b/usr.sbin/ctld/iscsi.hh
index d510e8c6731b..66bfecd62692 100644
--- a/usr.sbin/ctld/iscsi.hh
+++ b/usr.sbin/ctld/iscsi.hh
@@ -66,7 +66,7 @@ private:
std::string conn_initiator_name;
std::string conn_initiator_addr;
std::string conn_initiator_alias;
- uint8_t conn_initiator_isid[6];
+ uint8_t conn_initiator_isid[6] = {};
const struct sockaddr *conn_initiator_sa = nullptr;
int conn_max_recv_data_segment_limit = 0;
int conn_max_send_data_segment_limit = 0;