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

man: Fix uninitialized err_entry #9912

Merged
merged 1 commit into from
Mar 20, 2024
Merged

Conversation

rd-cea
Copy link
Contributor

@rd-cea rd-cea commented Mar 20, 2024

fi_cq_readerr was previously called on uninitialized .err_data and .err_data_size in a code snippet from fi_setup.7.md:

/* Sample error handling */
struct fi_cq_msg_entry entry;
struct fi_cq_err_entry err_entry;
int ret;

ret = fi_cq_read(cq, &entry, 1);
if (ret == -FI_EAVAIL)
    ret = fi_cq_readerr(cq, &err_entry, 0);

According to fi_cq.3.md however, both .err_data and .err_data_size must be initialized prior to any call to fi_cq_readerr.

err_data : The err_data field is used to return provider specific information, if available, about the error. On input, err_data should reference a data buffer of size err_data_size. On output, the provider will fill in this buffer with any provider specific data which may help identify the cause of the error. The contents of the err_data field and its meaning is provider specific. It is intended to be used as a debugging aid. See fi_cq_strerror for additional details on converting this error data into a human readable string. See the compatibility note below on how this field is used for older libfabric releases.

err_data_size : On input, err_data_size indicates the size of the err_data buffer in bytes. On output, err_data_size will be set to the number of bytes copied to the err_data buffer. The err_data information is typically used with fi_cq_strerror to provide details about the type of error that occurred.

By looking at the source code and at Valgrind errors in my application based on this code snippet, input .err_data and .err_data_size are used in ofi_cq_readerr, and must indeed be initialized.

size_t err_data_size = buf->err_data_size;

fi_cq_readerr is no longer called on uninitialized
err_data and err_data_size in fi_setup.7.md.

Signed-off-by: Rémi Dehenne <remi.dehenne@cea.fr>
Copy link
Contributor

@j-xiong j-xiong left a comment

Choose a reason for hiding this comment

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

Thanks!

@j-xiong j-xiong merged commit 358422a into ofiwg:main Mar 20, 2024
9 checks passed
@rd-cea rd-cea deleted the doc-fix-fi-cq-readerr branch March 21, 2024 13:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants