Skip to content
Snippets Groups Projects
Commit 0c3e0913 authored by Masahiro Yamada's avatar Masahiro Yamada
Browse files

modpost: remove incorrect code in do_eisa_entry()


This function contains multiple bugs after the following commits:

 - ac551828 ("modpost: i2c aliases need no trailing wildcard")
 - 6543becf ("mod/file2alias: make modalias generation safe for cross compiling")

Commit ac551828 inserted the following code to do_eisa_entry():

    else
            strcat(alias, "*");

This is incorrect because 'alias' is uninitialized. If it is not
NULL-terminated, strcat() could cause a buffer overrun.

Even if 'alias' happens to be zero-filled, it would output:

    MODULE_ALIAS("*");

This would match anything. As a result, the module could be loaded by
any unrelated uevent from an unrelated subsystem.

Commit ac551828 introduced another bug.            

Prior to that commit, the conditional check was:

    if (eisa->sig[0])

This checked if the first character of eisa_device_id::sig was not '\0'.

However, commit ac551828 changed it as follows:

    if (sig[0])

sig[0] is NOT the first character of the eisa_device_id::sig. The
type of 'sig' is 'char (*)[8]', meaning that the type of 'sig[0]' is
'char [8]' instead of 'char'. 'sig[0]' and 'symval' refer to the same
address, which never becomes NULL.

The correct conversion would have been:

    if ((*sig)[0])

However, this if-conditional was meaningless because the earlier change
in commit ac551828 was incorrect.

This commit removes the entire incorrect code, which should never have
been executed.

Fixes: ac551828 ("modpost: i2c aliases need no trailing wildcard")
Fixes: 6543becf ("mod/file2alias: make modalias generation safe for cross compiling")
Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
parent e2ff1219
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment