diff mbox series

[1/2] improve_kernel_cve_report: stop when debug sources list no files

Message ID 20261203053348.4024389-1-ragaprasanth@gmail.com
State New
Headers show
Series [1/2] improve_kernel_cve_report: stop when debug sources list no files | expand

Commit Message

Prasanth R Dec. 3, 2026, 5:33 a.m. UTC
A kernel built without debug info (CONFIG_DEBUG_INFO_NONE) has only empty
entries in its debugsources file, and the script fails with an IndexError.
Skipping them is not enough: with no compiled files left, every CVE would
be ignored as not applicable. Skip entries without a path and stop with a
clear message if nothing is left.

Found with linux-fslc for imx6qdlsabresd.

AI-Generated: Uses Claude
Signed-off-by: Prasanth R <prasanth.r@lineo.co.jp>
---
 scripts/contrib/improve_kernel_cve_report.py | 6 ++++++
 1 file changed, 6 insertions(+)
diff mbox series

Patch

diff --git a/scripts/contrib/improve_kernel_cve_report.py b/scripts/contrib/improve_kernel_cve_report.py
index 41cbc1e222..76ba54d835 100755
--- a/scripts/contrib/improve_kernel_cve_report.py
+++ b/scripts/contrib/improve_kernel_cve_report.py
@@ -252,8 +252,14 @@  def read_debugsources(file_path):
             # We need to remove one level from the debug sources
             for source_list in json_data.values():
                 for source in source_list:
+                    # entries are empty if the kernel has no debug info
+                    if "/" not in source:
+                        continue
                     src = source.split("/",1)[1]
                     cfiles.add(src)
+    if not cfiles:
+        sys.exit(f"{file_path} lists no compiled sources: "
+                 "is the kernel built without debug info (CONFIG_DEBUG_INFO)?")
     return cfiles
 
 def check_kernel_compiled_files(compiled_files, cve_info):