Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cleanup(libsinsp): remove some more misaligned accesses #1706

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions userspace/libsinsp/fdinfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -269,8 +269,8 @@ class SINSP_PUBLIC sinsp_fdinfo

inline void set_unix_info(uint8_t* packed_data)
{
m_sockinfo.m_unixinfo.m_fields.m_source = *(uint64_t *)(packed_data + 1);
m_sockinfo.m_unixinfo.m_fields.m_dest = *(uint64_t *)(packed_data + 9);
memcpy(&m_sockinfo.m_unixinfo.m_fields.m_source, packed_data + 1, sizeof(uint64_t));
memcpy(&m_sockinfo.m_unixinfo.m_fields.m_dest, packed_data + 9, sizeof(uint64_t));
}

/*!
Expand Down
14 changes: 4 additions & 10 deletions userspace/libsinsp/sinsp_filtercheck_event.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -634,9 +634,7 @@ uint8_t* sinsp_filter_check_event::extract_error_count(sinsp_evt *evt, OUT uint3

if(pi != NULL)
{
ASSERT(pi->m_len == sizeof(uint64_t));

int64_t res = *(int64_t*)pi->m_val;
int64_t res = pi->as<int64_t>();
if(res < 0)
{
m_u32val = 1;
Expand All @@ -654,9 +652,7 @@ uint8_t* sinsp_filter_check_event::extract_error_count(sinsp_evt *evt, OUT uint3

if(pi != NULL)
{
ASSERT(pi->m_len == sizeof(uint64_t));

int64_t res = *(int64_t*)pi->m_val;
int64_t res = pi->as<int64_t>();
if(res < 0)
{
m_u32val = 1;
Expand Down Expand Up @@ -1202,9 +1198,7 @@ uint8_t* sinsp_filter_check_event::extract(sinsp_evt *evt, OUT uint32_t* len, bo

if(pi != NULL)
{
ASSERT(pi->m_len == sizeof(int64_t));

int64_t res = *(int64_t*)pi->m_val;
int64_t res = pi->as<int64_t>();

if(res >= 0)
{
Expand Down Expand Up @@ -1232,7 +1226,7 @@ uint8_t* sinsp_filter_check_event::extract(sinsp_evt *evt, OUT uint32_t* len, bo
pi = evt->get_param_by_name("fd");
if (pi)
{
int64_t res = *(int64_t*)pi->m_val;
int64_t res = pi->as<int64_t>();

if(res >= 0)
{
Expand Down
Loading