Fix off-by-one error when checking the number of cports a host-device
supports.
The CPORT_ID_MAX is the largest valid cport id so the maximum number of
cports a host-device can use is CPORT_ID_MAX + 1.
Signed-off-by: Johan Hovold <[email protected]>
Reviewed-by: Viresh Kumar <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
return ERR_PTR(-EINVAL);
}
- if (num_cports == 0 || num_cports > CPORT_ID_MAX) {
+ if (num_cports == 0 || num_cports > CPORT_ID_MAX + 1) {
dev_err(parent, "Invalid number of CPorts: %zu\n", num_cports);
return ERR_PTR(-EINVAL);
}