An uninitialized next-free-cluster value in the file system information

block is valid; do not consider it for correction.
This commit is contained in:
jakllsch 2013-01-17 16:45:48 +00:00
parent 5c4b55ca89
commit ec5e5d471b
1 changed files with 5 additions and 3 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: fat.c,v 1.23 2012/08/07 19:30:41 jakllsch Exp $ */
/* $NetBSD: fat.c,v 1.24 2013/01/17 16:45:48 jakllsch Exp $ */
/*
* Copyright (C) 1995, 1996, 1997 Wolfgang Solfrank
@ -28,7 +28,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: fat.c,v 1.23 2012/08/07 19:30:41 jakllsch Exp $");
__RCSID("$NetBSD: fat.c,v 1.24 2013/01/17 16:45:48 jakllsch Exp $");
#endif /* not lint */
#include <stdlib.h>
@ -605,7 +605,9 @@ checklost(int dosfs, struct bootblock *boot, struct fatEntry *fat)
ret = 1;
}
}
if (boot->FSNext >= boot->NumClusters || (boot->NumFree && fat[boot->FSNext].next != CLUST_FREE)) {
if (boot->FSNext != 0xffffffffU &&
(boot->FSNext >= boot->NumClusters ||
(boot->NumFree && fat[boot->FSNext].next != CLUST_FREE))) {
pwarn("Next free cluster in FSInfo block (%u) %s\n",
boot->FSNext,
(boot->FSNext >= boot->NumClusters) ? "invalid" : "not free");