Preserve module version type positions #66
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Initialize the "res" array of get_module_verinfo() to three empty elements to
preserve relative positions of different version types stored there, when the
"res" array is expanded in check_version_sanity(), and to allow comparison
between compatible version types only.
Without that, if the module in question only had "srcversion", which is
assigned to "res[1]", then after e.g. this assignment in
check_version_sanity():
The value will end up in "kernels_info[0]", the position that is
supposed to be occupied by the regular "version".
In the case of the stock kernel's module having only "srcversion", but
the installed module having a regular "version", this could lead to a
comparison between them, in check_version_sanity(), and an incorrect
conclusion about the module being (not) newer in the kernel.
E.g. when the stock kernel's module only has this field in modinfo:
but the module being installed has these fields:
DKMS would incorrectly conclude: