diff --git a/sbin/fsck_msdos/boot.c b/sbin/fsck_msdos/boot.c index 8632ce5d3dd0..9d3c19b2e081 100644 --- a/sbin/fsck_msdos/boot.c +++ b/sbin/fsck_msdos/boot.c @@ -27,7 +27,7 @@ #include #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 @@ -184,7 +184,7 @@ readboot(int dosfs, struct bootblock *boot) 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 @@ readboot(int dosfs, struct bootblock *boot) 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 --git a/sbin/fsck_msdos/dosfs.h b/sbin/fsck_msdos/dosfs.h index 0a3c963e9773..0afa96981bbf 100644 --- a/sbin/fsck_msdos/dosfs.h +++ b/sbin/fsck_msdos/dosfs.h @@ -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 @@ struct bootblock { 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: */