diff options
author | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2024-03-13 13:13:58 +0000 |
---|---|---|
committer | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2024-03-13 13:13:58 +0000 |
commit | e8835649877a8032ba22ecda090738fe328d7e79 (patch) | |
tree | 005d531b4429d752423c373b5a57fdde9771aa9b /sys | |
parent | bb73b05513de2150203290cc542b58dd59f58ae8 (diff) |
Fix potential NULL pointer dereference in dt(4).
When initializing the profiling probes, check if we sucessfully
allocated the probe, before registering it. This avoids a NULL
pointer dereference when probe allocation has failed.
from Christian Ludwig
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/dt/dt_prov_profile.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/dev/dt/dt_prov_profile.c b/sys/dev/dt/dt_prov_profile.c index 1388770fb39..26972585d04 100644 --- a/sys/dev/dt/dt_prov_profile.c +++ b/sys/dev/dt/dt_prov_profile.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dt_prov_profile.c,v 1.6 2024/02/09 17:42:18 cheloha Exp $ */ +/* $OpenBSD: dt_prov_profile.c,v 1.7 2024/03/13 13:13:57 bluhm Exp $ */ /* * Copyright (c) 2019 Martin Pieuchot <mpi@openbsd.org> @@ -53,13 +53,13 @@ int dt_prov_profile_init(void) { dtpp_profile = dt_dev_alloc_probe("hz", "97", &dt_prov_profile); - dt_dev_register_probe(dtpp_profile); if (dtpp_profile == NULL) return 0; + dt_dev_register_probe(dtpp_profile); dtpp_interval = dt_dev_alloc_probe("hz", "1", &dt_prov_interval); - dt_dev_register_probe(dtpp_interval); if (dtpp_interval == NULL) return 1; + dt_dev_register_probe(dtpp_interval); return 2; } |