diff --git a/kernel_version.go b/kernel_version.go index 399768801..e7a52403e 100644 --- a/kernel_version.go +++ b/kernel_version.go @@ -51,6 +51,13 @@ func KernelVersionFromReleaseString(releaseString string) (uint32, error) { if len(versionParts) >= 4 { patch, _ = strconv.ParseUint(versionParts[3], 10, 8) } + + // clamp patch/sublevel to 255 EARLY in 4.14.252 because they merged this too early: + // https://github.com/torvalds/linux/commit/e131e0e880f942f138c4b5e6af944c7ddcd7ec96 + if major == 4 && minor == 14 && patch >= 252 { + patch = 255 + } + out := major*256*256 + minor*256 + patch return uint32(out), nil } diff --git a/kernel_version_test.go b/kernel_version_test.go index dfa224cc8..781939672 100644 --- a/kernel_version_test.go +++ b/kernel_version_test.go @@ -40,6 +40,7 @@ var testData = []struct { {true, "4.1.", 262400}, {true, "4.1", 262400}, {true, "4.19-ovh", 267008}, + {true, "4.14.252", kernelVersion: 265983}, } func TestKernelVersionFromReleaseString(t *testing.T) {