ddb: fix validation of cpu id in 'set db_cpu=x'

MFC after:	1 week
This commit is contained in:
Andriy Gapon 2017-12-05 14:22:08 +00:00
parent d1755e2845
commit 6e1c5d187c

View File

@ -85,8 +85,8 @@ db_var_db_cpu(struct db_variable *vp, db_expr_t *valuep, int op)
return (1);
case DB_VAR_SET:
if (*(int *)valuep < -1 && *(int *)valuep > mp_maxid) {
db_printf("Invalid value: %d", *(int*)valuep);
if (*(int *)valuep < -1 || *(int *)valuep > mp_maxid) {
db_printf("Invalid value: %d\n", *(int*)valuep);
return (0);
}
db_cpu = *(int *)valuep;