Skip to content

Conversation

@victorjulien
Copy link
Member

Since the layout has to be preserved, padding is added.

This is to help the Suricata scan-build CI jobs currently showing lots of

2024-12-17T21:44:21.4770026Z ./../libhtp/htp/htp.h:208:8: warning: Excessive padding in 'struct htp_tx_t' (32 padding bytes, where 0 is optimal). Optimal fields order: connp, conn, cfg, user_data, request_line, request_method, request_uri, request_protocol, parsed_uri, parsed_uri_raw, request_message_len, request_entity_len, request_headers, request_content_type, request_content_length, hook_request_body_data, hook_response_body_data, request_urlenp_query, request_urlenp_body, request_mpartp, request_params, request_cookies, request_auth_username, request_auth_password, request_hostname, response_line, response_protocol, response_status, response_message, response_headers, response_message_len, response_entity_len, response_content_length, response_content_type, flags, index, is_config_shared, request_ignored_lines, request_method_number, request_protocol_number, is_protocol_0_9, request_transfer_coding, request_content_encoding, request_auth_type, request_port_number, response_ignored_lines, response_protocol_number, response_status_number, response_status_expected_number, seen_100continue, response_transfer_coding, response_content_encoding, response_content_encoding_processing, request_progress, response_progress, req_header_repetitions, res_header_repetitions, consider reordering the fields or adding explicit padding members [optin.performance.Padding]
2024-12-17T21:44:21.4774220Z   208 | struct htp_tx_t {
2024-12-17T21:44:21.4774415Z       | ~~~~~~~^~~~~~~~~~
2024-12-17T21:44:21.4774688Z   209 |     /** The connection parser associated with this transaction. */
2024-12-17T21:44:21.4775028Z       |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2024-12-17T21:44:21.4775288Z   210 |     htp_connp_t *connp;
2024-12-17T21:44:21.4775495Z       |     ~~~~~~~~~~~~~~~~~~~
2024-12-17T21:44:21.4775812Z   211 | 
2024-12-17T21:44:21.4776177Z   212 |     /** The connection to which this transaction belongs. */
2024-12-17T21:44:21.4776708Z       |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2024-12-17T21:44:21.4777117Z   213 |     htp_conn_t *conn;   
2024-12-17T21:44:21.4777468Z       |     ~~~~~~~~~~~~~~~~~
2024-12-17T21:44:21.4777763Z   214 | 
2024-12-17T21:44:21.4778203Z   215 |     /** The configuration structure associated with this transaction. */
2024-12-17T21:44:21.4778783Z       |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2024-12-17T21:44:21.4779051Z   216 |     htp_cfg_t *cfg;
2024-12-17T21:44:21.4779246Z       |     ~~~~~~~~~~~~~~~
2024-12-17T21:44:21.4779627Z   217 | 
2024-12-17T21:44:21.4779825Z   218 |     /**
2024-12-17T21:44:21.4780094Z       |     ~~~
2024-12-17T21:44:21.4780625Z   219 |      * Is the configuration structure shared with other transactions or connections? If
2024-12-17T21:44:21.4781060Z       |      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2024-12-17T21:44:21.4781456Z   220 |      * this field is set to HTP_CONFIG_PRIVATE, the transaction owns the configuration.
2024-12-17T21:44:21.4781965Z       |      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2024-12-17T21:44:21.4782224Z   221 |      */
2024-12-17T21:44:21.4782384Z       |      ~~
2024-12-17T21:44:21.4782562Z   222 |     int is_config_shared;
2024-12-17T21:44:21.4782779Z       |     ~~~~~~~~~~~~~~~~~~~~~
2024-12-17T21:44:21.4782975Z   223 | 

@suricata-qa
Copy link

ERROR:

ERROR: QA failed on build_asan.

Pipeline 23986

@suricata-qa
Copy link

ERROR:

ERROR: QA failed on build_asan.

Pipeline 23987

Since the layout has to be preserved, padding is added.
@suricata-qa
Copy link

Information: QA ran without warnings.

Pipeline 23988

#define SCAN_BUILD_X64_PADDING(x) x
#else
#define SCAN_BUILD_X64_PADDING(_x)
#endif
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a nit, but I think that a newline here could help in reading that what comes after this #endif is not part of the same block of code.

#else
#ifdef LONG_BIT
#define __WORDSIZE LONG_BIT
#endif
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#else error ?

Copy link
Contributor

@catenacyber catenacyber left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok for me

@victorjulien victorjulien merged commit 46b43fd into OISF:0.5.x Dec 20, 2024
10 checks passed
@victorjulien
Copy link
Member Author

Merged in #437, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants