diff options
author | phk <phk@FreeBSD.org> | 2002-09-08 15:15:12 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2002-09-08 15:15:12 +0000 |
commit | e5c7442a0ce8abebedb161765b960e65be0113fc (patch) | |
tree | 2f749da5539b4ba6ed6a499fcb3a54d9459a9782 | |
parent | 6030f301125d27caade850afcb344110a1712545 (diff) | |
download | FreeBSD-src-e5c7442a0ce8abebedb161765b960e65be0113fc.zip FreeBSD-src-e5c7442a0ce8abebedb161765b960e65be0113fc.tar.gz |
Fix a logic bug in the struct dev_t allocation code.
Spotted by: Neelkanth Natu <neelnatu@yahoo.com>
-rw-r--r-- | sys/kern/kern_conf.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/sys/kern/kern_conf.c b/sys/kern/kern_conf.c index d1ce2fc..2c54675 100644 --- a/sys/kern/kern_conf.c +++ b/sys/kern/kern_conf.c @@ -182,16 +182,16 @@ allocdev(void) static int stashed; struct specinfo *si; - if (stashed >= DEVT_STASH) { - MALLOC(si, struct specinfo *, sizeof(*si), M_DEVT, - M_USE_RESERVE | M_ZERO); - } else if (LIST_FIRST(&dev_free)) { + if (LIST_FIRST(&dev_free)) { si = LIST_FIRST(&dev_free); LIST_REMOVE(si, si_hash); + } else if (stashed >= DEVT_STASH) { + MALLOC(si, struct specinfo *, sizeof(*si), M_DEVT, + M_USE_RESERVE | M_ZERO); } else { si = devt_stash + stashed++; bzero(si, sizeof *si); - si->si_flags |= SI_STASHED; + si->si_flags |= SI_STASHED; } LIST_INIT(&si->si_children); TAILQ_INIT(&si->si_snapshots); |