1
0
mirror of https://github.com/systemd/systemd.git synced 2025-02-04 21:47:31 +03:00

udev/ethtool: fix error detection of ethtool_link_mode_bit_from_string()

This commit is contained in:
Yu Watanabe 2019-02-25 12:35:40 +09:00
parent 391f6bc1db
commit 84fb56d396

View File

@ -775,7 +775,9 @@ int config_parse_advertise(const char *unit,
break;
mode = ethtool_link_mode_bit_from_string(w);
if (mode < 0) {
/* We reuse the kernel provided enum which does not contain negative value. So, the cast
* below is mandatory. Otherwise, the check below always passes and access an invalid address. */
if ((int) mode < 0) {
log_syntax(unit, LOG_ERR, filename, line, 0, "Failed to parse advertise mode, ignoring: %s", w);
continue;
}