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

prov/sockets: Coverity scan fix and minor code cleanup #1104

Closed
wants to merge 2 commits into from

Conversation

shantonu
Copy link
Contributor

  • Added check for NULL value of pe_affinity env var to fix coverity scan issue
  • Removed a redundant setting of pe_entry->context
  • Removed a redundant calculation of data length in pe_entry

@jithinjosepkl can you please review this?
Signed-off-by: Shantonu Hossain shantonu.hossain@intel.com

@shefty
Copy link
Member

shefty commented Jun 23, 2015

This probably should have been broken into 2 separate patches. See inline note

@@ -1429,7 +1429,6 @@ static int sock_pe_process_rx_send(struct sock_pe *pe, struct sock_rx_ctx *rx_ct
rx_entry->data = pe_entry->data;
rx_entry->ignore = 0;
rx_entry->comp = pe_entry->comp;
pe_entry->context = rx_entry->context;
Copy link
Member

Choose a reason for hiding this comment

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

Why was this changed?

The change to setting data_len looks like a valid fix, versus a code cleanup. The change to context needs more explanation.

Never mind - I was reading the data_len change wrong -- it looks like a simple cleanup. Reading the source, I see why the context change was done, but the patch description should explain that better. Reading just the patch, the change looks wrong.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry, the description should have been clearer. Updating the description

shantonu added 2 commits June 23, 2015 15:04
Signed-off-by: Shantonu Hossain <shantonu.hossain@intel.com>
Signed-off-by: Shantonu Hossain <shantonu.hossain@intel.com>
@shantonu
Copy link
Contributor Author

Divided into two patches and updated the description.

if(!s) {
SOCK_LOG_DBG("Invalid FI_SOCKETS_PE_AFFINITY value\n");
return;
}
Copy link
Member

Choose a reason for hiding this comment

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

This check shouldn't be needed. This comes from fi_var_get_str(). If that call returns success, the return string will not be NULL.

Copy link
Member

Choose a reason for hiding this comment

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

The coverity issue deals with the saveptra variable:

CID 100409 (#1 of 1): Explicit null dereferenced (FORWARD_NULL)6. var_deref_model: Passing &saveptra to __strtok_r_1c, which dereferences null saveptra. [show details]

This is not an actual issue. The checker just can't distinguish the first call to strtok_r, versus a subsequent call. I marked this defect as invalid in coverity. Hopefully that works to dismiss it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I also found that the check is not needed but since it was reported by coverity, I added it. Thanks for reporting it in coverity.

Copy link
Member

Choose a reason for hiding this comment

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

If you re-read the coverity report, the issue is not the 's' parameter into strtok_r, but the 'saveptra' parameter. This change would not have fixed the issue.

@shefty
Copy link
Member

shefty commented Jun 23, 2015

Merging manually

@shefty shefty closed this Jun 23, 2015
@shantonu shantonu deleted the pr/sockets-coverityfix branch June 26, 2015 20:18
sungeunchoi pushed a commit to sungeunchoi/libfabric that referenced this pull request Dec 21, 2016
prov/gni: Add NIC list lock to mem reg path
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants