summaryrefslogtreecommitdiff
path: root/sys/dev/fss.c
diff options
context:
space:
mode:
authormaxv <maxv@NetBSD.org>2019-08-07 10:36:19 +0000
committermaxv <maxv@NetBSD.org>2019-08-07 10:36:19 +0000
commit2e7c08d9d9c7cbe655c4dbe7a949dea0e52eeec3 (patch)
tree269dc3d07c0c59744e4463b2e575a11a077dc559 /sys/dev/fss.c
parenta9492144bea34bcaf75ba7c71f960415754b8669 (diff)
Check fc_type before fc_cluster, because the latter may not be initialized.
This is harmless because fc_type is always initialized properly, so the next branch wouldn't have been taken.
Diffstat (limited to 'sys/dev/fss.c')
-rw-r--r--sys/dev/fss.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/sys/dev/fss.c b/sys/dev/fss.c
index 019d2c38190..8123ed1b667 100644
--- a/sys/dev/fss.c
+++ b/sys/dev/fss.c
@@ -1,4 +1,4 @@
-/* $NetBSD: fss.c,v 1.107 2019/02/20 10:03:25 hannken Exp $ */
+/* $NetBSD: fss.c,v 1.108 2019/08/07 10:36:19 maxv Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fss.c,v 1.107 2019/02/20 10:03:25 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fss.c,v 1.108 2019/08/07 10:36:19 maxv Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -992,16 +992,19 @@ restart:
return 0;
}
- for (scp = sc->sc_cache; scp < scl; scp++)
- if (scp->fc_cluster == cl) {
- if (scp->fc_type == FSS_CACHE_VALID) {
+ for (scp = sc->sc_cache; scp < scl; scp++) {
+ if (scp->fc_type == FSS_CACHE_VALID) {
+ if (scp->fc_cluster == cl) {
mutex_exit(&sc->sc_slock);
return 0;
- } else if (scp->fc_type == FSS_CACHE_BUSY) {
+ }
+ } else if (scp->fc_type == FSS_CACHE_BUSY) {
+ if (scp->fc_cluster == cl) {
cv_wait(&scp->fc_state_cv, &sc->sc_slock);
goto restart;
}
}
+ }
for (scp = sc->sc_cache; scp < scl; scp++)
if (scp->fc_type == FSS_CACHE_FREE) {