diff options
| author | John Baldwin <jhb@FreeBSD.org> | 2025-09-02 18:40:30 +0000 |
|---|---|---|
| committer | John Baldwin <jhb@FreeBSD.org> | 2025-09-02 18:40:30 +0000 |
| commit | 16459743927068abbee34ce3f266b38c71968232 (patch) | |
| tree | 12eb62d5967c9a1f7c990c29e2466bc4b9a49972 | |
| parent | 45488e95b4c6152ed4e6b3e488b6590897e5fa64 (diff) | |
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
| -rw-r--r-- | usr.sbin/ctld/ctld.hh | 6 | ||||
| -rw-r--r-- | 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; |
