Module Name: src Committed By: maxv Date: Wed Aug 7 10:36:19 UTC 2019
Modified Files: src/sys/dev: fss.c Log Message: 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. To generate a diff of this commit: cvs rdiff -u -r1.107 -r1.108 src/sys/dev/fss.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/dev/fss.c diff -u src/sys/dev/fss.c:1.107 src/sys/dev/fss.c:1.108 --- src/sys/dev/fss.c:1.107 Wed Feb 20 10:03:25 2019 +++ src/sys/dev/fss.c Wed Aug 7 10:36:19 2019 @@ -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) {