|
@@ -1364,7 +1364,7 @@ static int switch_pg_num(struct multipath *m, const char *pgstr)
|
|
|
char dummy;
|
|
|
|
|
|
if (!pgstr || (sscanf(pgstr, "%u%c", &pgnum, &dummy) != 1) || !pgnum ||
|
|
|
- (pgnum > m->nr_priority_groups)) {
|
|
|
+ !m->nr_priority_groups || (pgnum > m->nr_priority_groups)) {
|
|
|
DMWARN("invalid PG number supplied to switch_pg_num");
|
|
|
return -EINVAL;
|
|
|
}
|
|
@@ -1396,7 +1396,7 @@ static int bypass_pg_num(struct multipath *m, const char *pgstr, bool bypassed)
|
|
|
char dummy;
|
|
|
|
|
|
if (!pgstr || (sscanf(pgstr, "%u%c", &pgnum, &dummy) != 1) || !pgnum ||
|
|
|
- (pgnum > m->nr_priority_groups)) {
|
|
|
+ !m->nr_priority_groups || (pgnum > m->nr_priority_groups)) {
|
|
|
DMWARN("invalid PG number supplied to bypass_pg");
|
|
|
return -EINVAL;
|
|
|
}
|