-
Notifications
You must be signed in to change notification settings - Fork 325
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
Conversation
Config was not correctly read by API. Fix config copying. Signed-off-by: Jakub Dabek <jakub.dabek@intel.com>
0b8b79d
to
d510e67
Compare
Cannot fix checkpatch in a way it would pass - left best possible and readable way. |
There was a problem hiding this 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), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sizeof(new_config)
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 ?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
https://www.kernel.org/doc/html/latest/dev-tools/checkpatch.html
Looks good enough to me. |
@lyakh Was right here. After another debug session narrowed it down to testing issue. Closing. |
Config was not correctly read by API. Fix config copying.