diff options
author | 2019-11-03 16:23:36 +0000 | |
---|---|---|
committer | 2019-11-03 16:23:36 +0000 | |
commit | 06389e20099b694b0a68ed82418e164ee90fd21a (patch) | |
tree | 3bc8082eb7427a78a035d8dc4aa0d98daaac89ad | |
parent | add missing handler for float cast overflow; caused by code in (diff) | |
download | wireguard-openbsd-06389e20099b694b0a68ed82418e164ee90fd21a.tar.xz wireguard-openbsd-06389e20099b694b0a68ed82418e164ee90fd21a.zip |
rework kubsan_state into simpler boolean named kubsan_cold
-rw-r--r-- | sys/kern/subr_kubsan.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/sys/kern/subr_kubsan.c b/sys/kern/subr_kubsan.c index f90046dca8c..11f7397fa8a 100644 --- a/sys/kern/subr_kubsan.c +++ b/sys/kern/subr_kubsan.c @@ -1,4 +1,4 @@ -/* $OpenBSD: subr_kubsan.c,v 1.9 2019/11/03 16:16:06 anton Exp $ */ +/* $OpenBSD: subr_kubsan.c,v 1.10 2019/11/03 16:23:36 anton Exp $ */ /* * Copyright (c) 2019 Anton Lindqvist <anton@openbsd.org> @@ -199,7 +199,7 @@ int kubsan_watch = 1; struct kubsan_report *kubsan_reports = NULL; struct task kubsan_task = TASK_INITIALIZER(kubsan_report, NULL); unsigned int kubsan_slot = 0; -int kubsan_state = 0; +int kubsan_cold = 1; /* * Compiling the kernel with `-fsanitize=undefined' will cause the following @@ -386,7 +386,6 @@ kubsan_init(void) { kubsan_reports = (void *)uvm_pageboot_alloc( sizeof(struct kubsan_report) * KUBSAN_NSLOTS); - kubsan_state = 1; } /* @@ -396,7 +395,7 @@ kubsan_init(void) void kubsan_start(void) { - kubsan_state = 2; + kubsan_cold = 0; if (kubsan_slot > 0) task_add(systq, &kubsan_task); @@ -439,7 +438,7 @@ kubsan_defer_report(struct kubsan_report *kr) { unsigned int slot; - if (__predict_false(kubsan_state == 0) || + if (__predict_false(kubsan_cold == 1) || kubsan_is_reported(kr->kr_src)) return; @@ -454,8 +453,7 @@ kubsan_defer_report(struct kubsan_report *kr) } memcpy(&kubsan_reports[slot], kr, sizeof(*kr)); - if (__predict_true(kubsan_state > 1)) - task_add(systq, &kubsan_task); + task_add(systq, &kubsan_task); } void |