Skip to content

Commit

Permalink
issue: HPCINFRA-1734 [CI] Coverity: upgrade to v2023.12
Browse files Browse the repository at this point in the history
Fix errors that popped up after updating to Coverity v2023.12

Signed-off-by: Bashar Abdelgafer <babdelgafer@nvidia.com>
  • Loading branch information
root authored and BasharRadya committed Jul 3, 2024
1 parent 510d523 commit 406b47c
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 11 deletions.
2 changes: 1 addition & 1 deletion contrib/jenkins_tests/cov.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ source $(dirname $0)/globals.sh

echo "Checking for coverity ..."

COVERITY_MODULE="${COVERITY_MODULE:-tools/cov-2021.12}"
COVERITY_MODULE="${COVERITY_MODULE:-tools/cov-2023.12}"
do_module "${COVERITY_MODULE}"

cd "$WORKSPACE"
Expand Down
2 changes: 1 addition & 1 deletion src/core/dev/ring_allocation_logic.cpp
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ ring_allocation_logic::ring_allocation_logic(ring_logic_t allocation_logic,
resource_allocation_key &ring_profile)
: m_ring_migration_ratio(ring_migration_ratio)
, m_migration_try_count(ring_migration_ratio)
, m_source(source)
, m_source(std::move(source))
{
if (ring_profile.get_ring_alloc_logic() == RING_LOGIC_PER_INTERFACE) {
ring_profile.set_ring_alloc_logic(allocation_logic);
Expand Down
11 changes: 9 additions & 2 deletions src/core/dev/ring_allocation_logic.h
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,13 @@ class source_t {
, m_object(object)
{
}
source_t(source_t&& other) noexcept
: m_fd(std::exchange(other.m_fd, -1))
, m_ip(std::move(other.m_ip))
, m_object(std::exchange(other.m_object, nullptr))
{
}

};

/**
Expand Down Expand Up @@ -122,7 +129,7 @@ class ring_allocation_logic_rx : public ring_allocation_logic {
}
ring_allocation_logic_rx(source_t source, resource_allocation_key &ring_profile)
: ring_allocation_logic(safe_mce_sys().ring_allocation_logic_rx,
safe_mce_sys().ring_migration_ratio_rx, source, ring_profile)
safe_mce_sys().ring_migration_ratio_rx, std::move(source), ring_profile)
{
debug_print_type("Rx");
}
Expand All @@ -137,7 +144,7 @@ class ring_allocation_logic_tx : public ring_allocation_logic {
}
ring_allocation_logic_tx(source_t source, resource_allocation_key &ring_profile)
: ring_allocation_logic(safe_mce_sys().ring_allocation_logic_tx,
safe_mce_sys().ring_migration_ratio_tx, source, ring_profile)
safe_mce_sys().ring_migration_ratio_tx, std::move(source), ring_profile)
{
debug_print_type("Tx");
}
Expand Down
2 changes: 1 addition & 1 deletion src/core/proto/flow_tuple.cpp
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ flow_tuple::flow_tuple(const flow_tuple &ft)

flow_tuple::flow_tuple(flow_tuple &&ft)
{
*this = ft;
*this = std::move(ft);
}

flow_tuple &flow_tuple::operator=(const flow_tuple &ft)
Expand Down
2 changes: 1 addition & 1 deletion src/core/proto/neighbour.h
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
class neigh_key {
public:
neigh_key(ip_addr addr, net_device_val *p_ndvl)
: m_ip_addrs(addr)
: m_ip_addrs(std::move(addr))
, m_p_net_dev_val(p_ndvl) {};
virtual ~neigh_key() {};

Expand Down
8 changes: 5 additions & 3 deletions src/core/proto/neighbour_table_mgr.cpp
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -135,16 +135,18 @@ void neigh_table_mgr::notify_cb(event *ev)
return;
}

ip_addr addr(ip_address(reinterpret_cast<void *>(&in), nl_info->addr_family),
nl_info->addr_family);


// Search for this neigh ip in cache_table
m_lock.lock();
net_device_val *p_ndev = g_p_net_device_table_mgr->get_net_device_val(nl_info->ifindex);

// find all neigh entries with an appropriate peer_ip and net_device
if (p_ndev) {
neigh_entry *p_ne = dynamic_cast<neigh_entry *>(get_entry(neigh_key(addr, p_ndev)));
neigh_entry *p_ne = dynamic_cast<neigh_entry *>(get_entry(neigh_key(
ip_addr(ip_address(reinterpret_cast<void *>(&in), nl_info->addr_family),
nl_info->addr_family)
, p_ndev)));
if (p_ne) {
// Call the relevant neigh_entry to handle the event
p_ne->handle_neigh_event(nl_ev);
Expand Down
2 changes: 1 addition & 1 deletion src/core/util/ip_address.h
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ class ip_address {

ip_address(const ip_address &addr) { *this = addr; }

ip_address(ip_address &&addr) { *this = addr; }
ip_address(ip_address &&addr) { *this = std::move(addr); }

const std::string to_str(sa_family_t family) const
{
Expand Down
3 changes: 2 additions & 1 deletion src/core/util/sys_vars.h
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -538,8 +538,9 @@ struct mce_sys_var {

// prevent unautothrized creation of objects
mce_sys_var()
: sysctl_reader(sysctl_reader_t::instance())
: sysctl_reader(sysctl_reader_t::instance()),stats_file(nullptr),m_ioctl{}
{

// coverity[uninit_member]
get_env_params();
}
Expand Down
Empty file modified src/core/util/utils.cpp
100644 → 100755
Empty file.

0 comments on commit 406b47c

Please sign in to comment.