Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
checkpatch: Avoid catastrophic backtracking.
As Frode Nordahl points out in [0], it is possible for the python regex module to enter a case of catastrophic backtracking which causes oscillation between states and hangs the checkpatch script. One suggested solution to these cases is to use an anchor[1] in the regex, which should force the backtrack to exit early. However, when I tested this, it didn't seem to improve anything (since the start is already anchored, and trying to anchor the end results in the same hang). Instead, we explicitly check that the line ends with '\\' before trying to match on the 'if-inside-a-macro' check. A new check is added to catch the case in checkpatch. 0: https://mail.openvswitch.org/pipermail/ovs-dev/2021-August/386881.html 1: https://stackoverflow.com/questions/22072406/preventing-any-backtracking-in-regex-past-a-specific-pattern Signed-off-by: Aaron Conole <[email protected]> Signed-off-by: Ilya Maximets <[email protected]>
- Loading branch information