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

Use u16 for kernel patch version number #137

Merged
merged 3 commits into from Aug 11, 2021
Merged

Conversation

zz85
Copy link
Contributor

@zz85 zz85 commented Jul 28, 2021

@eminence
Copy link
Owner

Thanks, this fix looks fine to me. But what do you think about only changing patch: u16, instead of changing all 3 fields to u32?

@zz85
Copy link
Contributor Author

zz85 commented Aug 11, 2021

i personally prefer using u32s since i think it isn't much of a space trade off, and that u32s is referenced in the kernel code https://github.com/torvalds/linux/blob/5bfc75d92efd494db37f5c4c173d3639d4772966/tools/testing/selftests/bpf/prog_tests/core_extern.c#L12

but i'll make a change to unblock envs this crate is crashing on

@zz85 zz85 changed the title Use 32 bit integers to represent kernel version numbers Fix parsing of kernel version numbers Aug 11, 2021
@zz85 zz85 changed the title Fix parsing of kernel version numbers Use u16 for kernel patch version number Aug 11, 2021
@eminence
Copy link
Owner

True, but then it looks like the KERNEL_VERSION macro expects each field to be only u8, as it then packs everything into a single u32:

#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))

But we can always revisit this later. Thanks for making this change!

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.

kernel version parsing panic
2 participants