Loading drivers/s390/net/qeth_l3_sys.c +14 −13 Original line number Original line Diff line number Diff line Loading @@ -409,21 +409,22 @@ static ssize_t qeth_l3_dev_ipato_add4_show(struct device *dev, static int qeth_l3_parse_ipatoe(const char *buf, enum qeth_prot_versions proto, static int qeth_l3_parse_ipatoe(const char *buf, enum qeth_prot_versions proto, u8 *addr, int *mask_bits) u8 *addr, int *mask_bits) { { const char *start, *end; const char *start; char *tmp; char *sep, *tmp; char buffer[40] = {0, }; int rc; start = buf; /* Expected input pattern: %addr/%mask */ /* get address string */ sep = strnchr(buf, 40, '/'); end = strchr(start, '/'); if (!sep) if (!end || (end - start >= 40)) { return -EINVAL; return -EINVAL; } strncpy(buffer, start, end - start); /* Terminate the %addr sub-string, and parse it: */ if (qeth_l3_string_to_ipaddr(buffer, proto, addr)) { *sep = '\0'; return -EINVAL; rc = qeth_l3_string_to_ipaddr(buf, proto, addr); } if (rc) start = end + 1; return rc; start = sep + 1; *mask_bits = simple_strtoul(start, &tmp, 10); *mask_bits = simple_strtoul(start, &tmp, 10); if (!strlen(start) || if (!strlen(start) || (tmp == start) || (tmp == start) || Loading Loading
drivers/s390/net/qeth_l3_sys.c +14 −13 Original line number Original line Diff line number Diff line Loading @@ -409,21 +409,22 @@ static ssize_t qeth_l3_dev_ipato_add4_show(struct device *dev, static int qeth_l3_parse_ipatoe(const char *buf, enum qeth_prot_versions proto, static int qeth_l3_parse_ipatoe(const char *buf, enum qeth_prot_versions proto, u8 *addr, int *mask_bits) u8 *addr, int *mask_bits) { { const char *start, *end; const char *start; char *tmp; char *sep, *tmp; char buffer[40] = {0, }; int rc; start = buf; /* Expected input pattern: %addr/%mask */ /* get address string */ sep = strnchr(buf, 40, '/'); end = strchr(start, '/'); if (!sep) if (!end || (end - start >= 40)) { return -EINVAL; return -EINVAL; } strncpy(buffer, start, end - start); /* Terminate the %addr sub-string, and parse it: */ if (qeth_l3_string_to_ipaddr(buffer, proto, addr)) { *sep = '\0'; return -EINVAL; rc = qeth_l3_string_to_ipaddr(buf, proto, addr); } if (rc) start = end + 1; return rc; start = sep + 1; *mask_bits = simple_strtoul(start, &tmp, 10); *mask_bits = simple_strtoul(start, &tmp, 10); if (!strlen(start) || if (!strlen(start) || (tmp == start) || (tmp == start) || Loading