Skip to content

kerneldevice,generic: input pattern to string match is not regex

The input pattern given to the string_match() method is not a regex pattern and we cannot use it as that, because all the special characters (e.g. '.') would not be treated correctly.

Also, the prefix matching with the wildcard at the end of the string needs to be converted to a proper regex wildcard, i.e. '.*'.

This logic also adds support for suffix matching, with a wildcard at the beginning of the string, e.g. as the ones used for the wwan kernel device name matching rules (i.e. '*MBIM').

Unit tests are added to cover all cases, most of these tests were failing without the fixes implemented here.

Merge request reports