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

gPTP - add some NULL pointer checking #471

Merged
merged 4 commits into from
Sep 8, 2016

Conversation

andrew-elder
Copy link

This pull request adds some NULL pointer checking related to announce processing.

@@ -598,7 +598,8 @@ void IEEE1588Port::processEvent(Event e)

case STATE_CHANGE_EVENT:
if (!automotive_profile) { // BMCA is not active with Automotive Profile
if ( clock->getPriority1() != 255 ) {
if ( clock->getPriority1() != 255 && qualified_announce != NULL ) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think checking qualified_announce here is redundant; it's set right before STATE_CHANGE_EVENT is queued for this port and it's also checked below when calculateERBest() is called on each port in your addition below. I can't see that it's accessed between here and the check below.

Copy link
Contributor

Choose a reason for hiding this comment

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

Agree with @pinealservo there's not really any way I could see that qualified_announce would be NULL. If you want to check for NULL, I think it would be better to check the value of EBest, but still not necessary.

Copy link
Author

Choose a reason for hiding this comment

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

This line was added due to null pointer faults (gPTP crashes) we observed in-house. I see that EBest checks were added here on the same day, so perhaps additional unnecessary checks were added. I'll update with this commit removed.

@pinealservo
Copy link
Contributor

I think the logic covers all the possibilities that could introduce badness in a multi-port implementation. I thought there was a missing one and made a comment about it, but I was mistaken and deleted it; if you get an email and can't find the reference, that's why.

If you'd like to leave the possibly-redundant check, I don't think it hurts anything and I may have missed the reason for it, so I won't object.

Andrew Elder added 2 commits September 8, 2016 09:21
@andrew-elder
Copy link
Author

I think I have now addressed all comments made by @pinealservo and @christopher-s-hall

@pinealservo
Copy link
Contributor

Looks good to me!

@pinealservo pinealservo merged commit e9a8c45 into Avnu:open-avb-next Sep 8, 2016
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.

3 participants