Module Name:    src
Committed By:   martin
Date:           Wed Oct 23 20:35:52 UTC 2019

Modified Files:
        src/sys/dev [netbsd-9]: fss.c

Log Message:
Pull up following revision(s) (requested by maxv in ticket #356):

        sys/dev/fss.c: revision 1.108

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.107.4.1 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.107.4.1
--- src/sys/dev/fss.c:1.107	Wed Feb 20 10:03:25 2019
+++ src/sys/dev/fss.c	Wed Oct 23 20:35:52 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: fss.c,v 1.107 2019/02/20 10:03:25 hannken Exp $	*/
+/*	$NetBSD: fss.c,v 1.107.4.1 2019/10/23 20:35:52 martin 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.107.4.1 2019/10/23 20:35:52 martin 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) {

Reply via email to