]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
improve_kernel_cve_report: do not use custom version
authorDaniel Turull <daniel.turull@ericsson.com>
Fri, 4 Jul 2025 13:02:55 +0000 (15:02 +0200)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 10 Jul 2025 09:46:57 +0000 (10:46 +0100)
When using the version specified in cve-summary.json, we need to
remove the suffix containing the custom version to match the
versions from the CVEs.

This patch truncates the version from cve-summary.json to use only
the base version of the kernel.

This is only applicable for kernels where the user has added their
own version.

Signed-off-by: Daniel Turull <daniel.turull@ericsson.com>
Signed-off-by: Antonin Godard <antonin.godard@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
scripts/contrib/improve_kernel_cve_report.py

index a81aa0ff94343d897464a91c02c1e5cc5666809c..5c39df05a5a1a6bf60b1e5eab6e1cb8c7f801cdd 100755 (executable)
@@ -445,10 +445,12 @@ def main():
                 is_kernel=True
         if not is_kernel:
             continue
-
+        # We remove custom versions after -
+        upstream_version = Version(pkg["version"].split("-")[0])
+        logging.info("Checking kernel %s", upstream_version)
         kernel_cves = get_kernel_cves(args.datadir,
                                       compiled_files,
-                                      Version(pkg["version"]))
+                                      upstream_version)
         logging.info("Total kernel cves from kernel CNA: %s", len(kernel_cves))
         cves = {issue["id"]: issue for issue in pkg["issue"]}
         logging.info("Total kernel before processing cves: %s", len(cves))