getModulesDep: disallow regex submatches (MR 12)

At the moment modules in modules.dep are matched even on a submatch
e.g. looking up "msm" ends up matching "snd-soc-msm8916-digital.ko"
instead of "msm.ko". To fix this, disallow submatches using ^ and $.

(cherry picked from commit 15e99c3658)
This commit is contained in:
Minecrell
2021-09-20 23:53:38 +02:00
committed by Clayton Craft
parent 829009250c
commit b7f02ff970
2 changed files with 5 additions and 1 deletions

View File

@@ -665,7 +665,7 @@ func getModuleDeps(modName string, modulesDep io.Reader) ([]string, error) {
modNameReStr = s
}
}
re := regexp.MustCompile(modNameReStr)
re := regexp.MustCompile("^" + modNameReStr + "$")
s := bufio.NewScanner(modulesDep)
for s.Scan() {