Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sbin/fsck_msdos ClusterOffset actually needs to be able to b...



details:   https://anonhg.NetBSD.org/src/rev/d96a2b60533c
branches:  trunk
changeset: 333426:d96a2b60533c
user:      jakllsch <jakllsch%NetBSD.org@localhost>
date:      Mon Nov 03 18:55:04 2014 +0000

description:
ClusterOffset actually needs to be able to be negative.

diffstat:

 sbin/fsck_msdos/boot.c  |  8 ++++----
 sbin/fsck_msdos/dosfs.h |  4 ++--
 2 files changed, 6 insertions(+), 6 deletions(-)

diffs (50 lines):

diff -r a8171a5f1957 -r d96a2b60533c sbin/fsck_msdos/boot.c
--- a/sbin/fsck_msdos/boot.c    Mon Nov 03 16:50:20 2014 +0000
+++ b/sbin/fsck_msdos/boot.c    Mon Nov 03 18:55:04 2014 +0000
@@ -27,7 +27,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: boot.c,v 1.16 2014/07/07 19:04:37 christos Exp $");
+__RCSID("$NetBSD: boot.c,v 1.17 2014/11/03 18:55:04 jakllsch Exp $");
 #endif /* not lint */
 
 #include <stdlib.h>
@@ -184,7 +184,7 @@
                return FSFATAL;
        }
 
-       boot->ClusterOffset = (boot->RootDirEnts * 32 + boot->BytesPerSec - 1)
+       boot->ClusterOffset = (int)(boot->RootDirEnts * 32 + boot->BytesPerSec - 1)
            / boot->BytesPerSec
            + boot->ResSectors
            + boot->FATs * boot->FATsecs
@@ -205,8 +205,8 @@
                boot->NumSectors = boot->HugeSectors;
        boot->NumClusters = (boot->NumSectors - boot->ClusterOffset) / boot->SecPerClust;
 
-       if (boot->ClusterOffset > boot->NumSectors) {
-               pfatal("Cluster offset too large (%u clusters)\n",
+       if (boot->ClusterOffset > (intmax_t)boot->NumSectors) {
+               pfatal("Cluster offset too large (%d sectors)\n",
                    boot->ClusterOffset);
                return FSFATAL;
        }
diff -r a8171a5f1957 -r d96a2b60533c sbin/fsck_msdos/dosfs.h
--- a/sbin/fsck_msdos/dosfs.h   Mon Nov 03 16:50:20 2014 +0000
+++ b/sbin/fsck_msdos/dosfs.h   Mon Nov 03 18:55:04 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dosfs.h,v 1.6 2008/06/13 20:46:09 martin Exp $ */
+/*     $NetBSD: dosfs.h,v 1.7 2014/11/03 18:55:04 jakllsch Exp $       */
 
 /*
  * Copyright (C) 1995, 1996, 1997 Wolfgang Solfrank
@@ -70,7 +70,7 @@
        u_int32_t NumSectors;           /* how many sectors are there */
        u_int32_t FATsecs;              /* how many sectors are in FAT */
        u_int32_t NumFatEntries;        /* how many entries really are there */
-       u_int   ClusterOffset;          /* at what sector would sector 0 start */
+       int     ClusterOffset;          /* at what sector would sector 0 start */
        u_int   ClusterSize;            /* Cluster size in bytes */
 
        /* Now some statistics: */



Home | Main Index | Thread Index | Old Index