Skip to content

Commit

Permalink
Turn kernel module file parsing errors into warnings (#255)
Browse files Browse the repository at this point in the history
Co-authored-by: Florian Lehner <[email protected]>
  • Loading branch information
gnurizen and florianl authored Nov 26, 2024
1 parent 7c5db82 commit bdecd68
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions proc/proc.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,15 @@ func GetKernelModules(modulesPath string,

count++

nFields, _ := fmt.Sscanf(line, "%s %d %d %s %s 0x%x",
nFields, err := fmt.Sscanf(line, "%s %d %d %s %s 0x%x",
&name, &size, &refcount, &dependencies, &state, &address)
if err != nil {
log.Warnf("error parsing line '%s' in modules: '%s'", line, err)
continue
}
if nFields < 6 {
return nil, fmt.Errorf("unexpected line in modules: '%s'", line)
log.Warnf("unexpected line in modules: '%s'", line)
continue
}
if address == 0 {
continue
Expand Down

0 comments on commit bdecd68

Please sign in to comment.