diff options
author | Martin Pieuchot <mpi@cvs.openbsd.org> | 2020-08-13 11:28:32 +0000 |
---|---|---|
committer | Martin Pieuchot <mpi@cvs.openbsd.org> | 2020-08-13 11:28:32 +0000 |
commit | 5a8e2a5ee075c3e6482827a70acc41d9f2632501 (patch) | |
tree | 2484c15dafa49f6cd264df28c7021f02e15791bf | |
parent | bbaf42c1175df984baa58b30aabcee656f39d66c (diff) |
Always set `dtpr_size' to the total size required to hold all probe entries.
-rw-r--r-- | sys/dev/dt/dt_dev.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/sys/dev/dt/dt_dev.c b/sys/dev/dt/dt_dev.c index 19b37f83063..c23c3978077 100644 --- a/sys/dev/dt/dt_dev.c +++ b/sys/dev/dt/dt_dev.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dt_dev.c,v 1.8 2020/07/04 08:06:07 anton Exp $ */ +/* $OpenBSD: dt_dev.c,v 1.9 2020/08/13 11:28:31 mpi Exp $ */ /* * Copyright (c) 2019 Martin Pieuchot <mpi@openbsd.org> @@ -347,12 +347,11 @@ dt_ioctl_list_probes(struct dt_softc *sc, struct dtioc_probe *dtpr) size_t size; int error = 0; - if (dtpr->dtpr_size == 0) { - dtpr->dtpr_size = dt_nprobes * sizeof(*dtpi); + size = dtpr->dtpr_size; + dtpr->dtpr_size = dt_nprobes * sizeof(*dtpi); + if (size == 0) return 0; - } - size = dtpr->dtpr_size; dtpi = dtpr->dtpr_probes; memset(&info, 0, sizeof(info)); SIMPLEQ_FOREACH(dtp, &dt_probe_list, dtp_next) { |