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

vmh: fix config pasing issue #8772

Closed
wants to merge 1 commit into from

Conversation

dabekjakub
Copy link
Member

Config was not correctly read by API. Fix config copying.

Config was not correctly read by API. Fix config copying.

Signed-off-by: Jakub Dabek <jakub.dabek@intel.com>
@dabekjakub
Copy link
Member Author

Cannot fix checkpatch in a way it would pass - left best possible and readable way.

Copy link
Collaborator

@lyakh lyakh left a comment

Choose a reason for hiding this comment

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

sorry, don't understand what this is fixing. What exactly was wrong with the existing version?

cfg = &new_config;
}
else
memcpy_s(&new_config, sizeof(struct vmh_heap_config),
Copy link
Collaborator

Choose a reason for hiding this comment

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

sizeof(new_config)

Copy link
Member Author

Choose a reason for hiding this comment

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

Old code resulted in the following behavior:
cfg was read correctly only in the if context and reads done after that returned garbage.
I do not understand the origin of the issue but sticking to new_config which was created and zeroed in the function body seems to fix the issue.

Copy link
Member

Choose a reason for hiding this comment

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

can you give more context in the commit message, it looks like we are changing an object from heap ptr to stack ?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Old code resulted in the following behavior: cfg was read correctly only in the if context and reads done after that returned garbage. I do not understand the origin of the issue but sticking to new_config which was created and zeroed in the function body seems to fix the issue.

@dabekjakub sorry, I have a substantial issue with fixing something that we don't understand, especially if that's our own open-source software, not some 3rd-party black box.

Copy link
Member Author

Choose a reason for hiding this comment

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

Well, I agree but it is either this or the code not working. Which do we choose? This can be investigated further but this fixes heap creation.

Both ptr should be stack ptrs since cfg should be created runtime and not assigned space on the heap. At least that is an assumption I am making it is a client that will decide from where he will pass config.

@marc-hb
Copy link
Collaborator

marc-hb commented Jan 26, 2024

Cannot fix checkpatch in a way it would pass - left best possible and readable way.

https://www.kernel.org/doc/html/latest/dev-tools/checkpatch.html

Checkpatch is not always right. Your judgement takes precedence over checkpatch messages. If your code looks better with the violations, then its probably best left alone.

line length of 102 exceeds 100 columns

Looks good enough to me.

@dabekjakub
Copy link
Member Author

@lyakh Was right here. After another debug session narrowed it down to testing issue. Closing.

@dabekjakub dabekjakub closed this Jan 26, 2024
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.

4 participants