Skip to content

Commit

Permalink
Turn kernel module file parsing errors into warnings instead of hard (#…
Browse files Browse the repository at this point in the history
…19)

failing errors.
  • Loading branch information
gnurizen authored and umanwizard committed Nov 19, 2024
1 parent 1ed6d12 commit 9734320
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 @@ -122,10 +122,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("err parsing line in modules: '%s'", 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 9734320

Please sign in to comment.