aboutsummaryrefslogtreecommitdiff
path: root/sbin/fsck_msdosfs
Commit message (Collapse)AuthorAgeFilesLines
* fsck_msdosfs: truncate directory entry when the head pointer is invalid.Xin LI2021-11-041-2/+15
| | | | | | | | | | | | | | | | | | | | | | As far as we know, there is no FAT implementation that supported hard links, and our msdosfs driver assumed one cluster chain is only referenced by one directory entry and clears it out when the file is deleted. On the other hand, the current code would proceed with checkchain() when the directory entry's head cluster is a valid numbered cluster without checking if it was a valid head node of a cluster chain. So if the cluster do not being a chain (e.g. CLUST_FREE, CLUST_BAD), or was already referenced by another directory entry, this would trigger an assertion in check_chain() at a later time. Fix this by giving the user an option to truncate the directory entry when the head cluster is an invalid cluster, an visited head node, or not a head node. Reported by: NetApp (kevans@) Reviewed by: kevans, emaste (no objection) MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D32699
* Use %ju and cast to (uintmax_t) to avoid using PRI* macros.Xin LI2020-09-281-2/+2
| | | | | | | Suggested by: kevlo Notes: svn path=/head/; revision=366215
* Fix build.Xin LI2020-09-231-1/+1
| | | | | | | | Pointy hat to: delphij MFC after: 3 days Notes: svn path=/head/; revision=366065
* sbin/fsck_msdosfs: Fix an integer overflow on 32-bit platforms.Xin LI2020-09-231-4/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | The purpose of checksize() is to verify that the referenced cluster chain size matches the recorded file size (up to 2^32 - 1) in the directory entry. We follow the cluster chain, then multiple the cluster count by bytes per cluster to get the physical size, then check it against the recorded size. When a file is close to 4 GiB (between 4GiB - cluster size and 4GiB, both non-inclusive), the product of cluster count and bytes per cluster would be exactly 4 GiB. On 32-bit systems, because size_t is 32-bit, this would wrap back to 0, which will cause the file be truncated to 0. Fix this by using 64-bit physicalSize instead. This fix is inspired by an Android change request at https://android-review.googlesource.com/c/platform/external/fsck_msdos/+/1428461 PR: 249533 Reviewed by: kevlo MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D26524 Notes: svn path=/head/; revision=366064
* Do not overflow when calculating file system size.Xin LI2020-04-281-14/+12
| | | | | | | | | | Reported by: Hyeongseok Kim <hyeongseok kim lge com> Reviewed by: cem, Hyeongseok Kim MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D24603 Notes: svn path=/head/; revision=360428
* Fix a bug with dirty file system handling.Xin LI2020-04-273-2/+50
| | | | | | | | | | | | | | | | | | r356313 broke handling of dirty file system because we have restricted the correction of "odd" byte sequences to checkfat(), and as a result the dirty bit is never cleared. The old fsck_msdosfs code would write FAT twice to fix the dirty bit, which is also not ideal. Fix this by introducing a new rountine, cleardirty() which will perform the set of clean bit only, and use it in checkfilesys() if we thought the file system was dirty. Reviewed by: cem, emaste MFC after: 3 day Differential Revision: https://reviews.freebsd.org/D24581 Notes: svn path=/head/; revision=360359
* Use humanize_number to format available and bad space sizes.Xin LI2020-02-102-3/+30
| | | | | | | | | Reviewed by: mckusick (earlier version) MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D23050 Notes: svn path=/head/; revision=357716
* Diff reduction against NetBSD, no functional change.Xin LI2020-02-021-6/+7
| | | | | | | MFC after: 1 week Notes: svn path=/head/; revision=357421
* Tighten FAT checks and fix off-by-one error in corner case.Xin LI2020-01-121-33/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | sbin/fsck_msdosfs/fat.c: - readfat: * Only truncate out-of-range cluster pointers (1, or greater than NumClusters but smaller than CLUST_RSRVD), as the current cluster may contain some data. We can't fix reserved cluster pointers at this pass, because we do no know the potential cluster preceding it. * Accept valid cluster for head bitmap. This is a no-op, and mainly to improve code readability, because the 1 is already handled in the previous else if block. - truncate_at: absorbed into checkchain. - checkchain: save the previous node we have traversed in case that we have a chain that ends with a special (>= CLUST_RSRVD) cluster, or is free. In these cases, we need to truncate at the cluster preceding the current cluster, as the current cluster contains a marker instead of a next pointer and can not be changed to CLUST_EOF (the else case can happen if the user answered "no" at some point in readfat()). - clearchain: correct the iterator for next cluster so that we don't stop after clearing the first cluster. - checklost: If checkchain() thinks the chain have no cluster, it doesn't make sense to reconnect it, so don't bother asking. Reviewed by: kevlo MFC after: 24 days X-MFC-With: r356313 Differential Revision: https://reviews.freebsd.org/D23065 Notes: svn path=/head/; revision=356657
* Correct off-by-two issue when determining FAT type.Xin LI2020-01-111-3/+14
| | | | | | | | | | | | | | | | | | In the code we used NumClusters as the upper (non-inclusive) boundary of valid cluster number, so the actual value was 2 (CLUST_FIRST) more than the real number of clusters. This causes a FAT16 media with 65524 clusters be treated as FAT32 and might affect FAT12 media with 4084 clusters as well. To fix this, we increment NumClusters by CLUST_FIRST after the type determination. PR: 243179 MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D23082 Notes: svn path=/head/; revision=356636
* Apply typo fix from NetBSD, we have already applied all NetBSD changes soXin LI2020-01-111-2/+2
| | | | | | | | | update the NetBSD tag while I'm there. MFC after: 2 weeks Notes: svn path=/head/; revision=356629
* Require FAT to occupy at least one sector.Xin LI2020-01-111-1/+1
| | | | | | | | Obtained from: Android https://r.android.com/1205830 MFC after: 3 days Notes: svn path=/head/; revision=356628
* fsck_msdosfs.8: document -M.Xin LI2020-01-071-2/+17
| | | | | | | | | | | Reported by: mckusick Reviewed by: mckusick, emaste, bcr MFC after: 28 days X-MFC-with: r356313 Differential Revision: https://reviews.freebsd.org/D23049 Notes: svn path=/head/; revision=356434
* Reduce memory footprint of fsck_msdosfs.Xin LI2020-01-037-638/+1217
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a re-apply r356249 with changes to make GCC happy. This utility was initially written for FAT12/16, which were inherently small. When FAT32 support was added, the old data structure and algorithms remain used with minimal changes. With growing size of FAT32 media, the current data structure that requires 4 32-bit variables per each FAT32 table entry would consume up to 4 GiB of RAM, which can be too big for systems with limited RAM available. Address this by taking a different approach of validating the FAT. The FAT is essentially a set of linked lists of chains that was referenced by directory entries, and the checker needs to make sure that the linked chains of clusters do not have cross-linked chains, and every chain were referenced by one and only one directory entry. Instead of keeping track of the chain's 'head' cluster number, the size of the chain, the used status of the chain and the "next" pointer which is content of the FAT table, we create accessors for the FAT table data for the "next" pointer, and keep only one bit to indicate if the current cluster is a 'head' node of a cluster chain, in a bitmap. We further overhaul the FAT checker to find out the possible head nodes by excluding ones that are not (in other words, nodes that have some other nodes claiming them as the next node) instead of marking the head nodes for each node on the chain. This approach greatly reduced the complexiety of computation from O(N^2) worst case, to an O(N) scan for worst case. The file (cluster chain) length is not useful for the FAT checker, so don't bother to calculate them in the FAT checker and instead leave the task to the directory structure check, at which point we would have non-crossed cluster chains, and we are guaranteed that each cluster will be visited for at most one time. When checking the directory structures, we use the head node indicator to as the visited (used) flag: every cluster chain can only be referenced by one directory entry, so we clear them when calculating the length of the chain, and we can immediately tell if there are anomalies in the directory entry. As a result, the required RAM size is now 1 bit per each entry of the FAT table, plus memory needed to hold the FAT table in memory, instead of 16 bytes (=128 bits) per each entry. For FAT12 and FAT16, we will load the whole FAT table into memory as they are smaller than 128KiB, and for FAT32, we first attempt to mmap() it into memory, and when that fails, we would fall back to a simple LRU cache of 4 MiB of RAM. sbin/fsck_msdosfs/boot.c: - Added additional sanity checks for valid FAT32/FAT16/FAT12 cluster number. - FAT32: check if root directory starts with a valid cluster number, moved from dir.c. There is no point to proceed if the filesystem is already damaged beyond repair. sbin/fsck_msdosfs/check.c: - Combine phase 1 and phase 2, now that the readfat() is able to detect cross chains. sbin/fsck_msdosfs/dir.c: - Refactor code to use FAT accessor instead of accessing the internal representation of FAT table. - Make use of the cluster chain head bitmap. - Clarify and simplify directory entry check, remove unnecessary checks that are would be done at a later time (for example, whether the directory's second cluster is a valid one, which is examined more throughly in a later checkchain() and does not prevent us from proceeding further). sbin/fsck_msdosfs/dosfs.h: - Remove internal representation of FAT table, which is replaced by the head bitmap that is opaque to other code. - Added a special CLUST_DEAD cluster type to indicate errors. sbin/fsck_msdosfs/ext.h: - Added a flag that overrides mmap(2) setting. The corresponding command line option, -M is intentionally undocumented as we do not expect users to need it. - Added accessors for FAT table and convert existing interface to use it. sbin/fsck_msdosfs/fat.c: - Added head bitmap to represent whether a cluster is a head cluster. - Converted FAT internal representation to accessors. - Implemented a LRU cache for FAT32 when mmap(2) should not or can not be used. - _readfat: Attempt a mmap(2) and fall back to regular read for non-FAT32 file systems; use the LRU cache for FAT32 and prepopulate the cache with the first 4MiB of the entries. - readfat: Added support of head bitmap and use the population scan to detect bogus chains. - clusterdiff: removed, FATs are copied from the checked copy via writefat()/copyfat(). - checkchain: calculates the length of a cluster chain and make sure that it ends with a valid EOF marker. - clearchain: follow and clear a chain and maintain the free cluster count. - checklost: convert to use head bitmap. At the end of all other scans, the remaining 'head' nodes are leaders of lost cluster chains. sbin/fsck_msdosfs/fat.c: - Added a new -M option which is intentionally undocumented, to disable the use of mmap(). Reviewed by: kevlo MFC after: 1 month Relnotes: yes Differential Revision: https://reviews.freebsd.org/D22965 Notes: svn path=/head/; revision=356313
* Revert r356249 for now as it broke GCC builds.Xin LI2020-01-017-1217/+638
| | | | Notes: svn path=/head/; revision=356250
* Reduce memory footprint of fsck_msdosfs.Xin LI2020-01-017-638/+1217
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This utility was initially written for FAT12/16, which were inherently small. When FAT32 support was added, the old data structure and algorithms remain used with minimal changes. With growing size of FAT32 media, the current data structure that requires 4 32-bit variables per each FAT32 table entry would consume up to 4 GiB of RAM, which can be too big for systems with limited RAM available. Address this by taking a different approach of validating the FAT. The FAT is essentially a set of linked lists of chains that was referenced by directory entries, and the checker needs to make sure that the linked chains of clusters do not have cross-linked chains, and every chain were referenced by one and only one directory entry. Instead of keeping track of the chain's 'head' cluster number, the size of the chain, the used status of the chain and the "next" pointer which is content of the FAT table, we create accessors for the FAT table data for the "next" pointer, and keep only one bit to indicate if the current cluster is a 'head' node of a cluster chain, in a bitmap. We further overhaul the FAT checker to find out the possible head nodes by excluding ones that are not (in other words, nodes that have some other nodes claiming them as the next node) instead of marking the head nodes for each node on the chain. This approach greatly reduced the complexiety of computation from O(N^2) worst case, to an O(N) scan for worst case. The file (cluster chain) length is not useful for the FAT checker, so don't bother to calculate them in the FAT checker and instead leave the task to the directory structure check, at which point we would have non-crossed cluster chains, and we are guaranteed that each cluster will be visited for at most one time. When checking the directory structures, we use the head node indicator to as the visited (used) flag: every cluster chain can only be referenced by one directory entry, so we clear them when calculating the length of the chain, and we can immediately tell if there are anomalies in the directory entry. As a result, the required RAM size is now 1 bit per each entry of the FAT table, plus memory needed to hold the FAT table in memory, instead of 16 bytes (=128 bits) per each entry. For FAT12 and FAT16, we will load the whole FAT table into memory as they are smaller than 128KiB, and for FAT32, we first attempt to mmap() it into memory, and when that fails, we would fall back to a simple LRU cache of 4 MiB of RAM. sbin/fsck_msdosfs/boot.c: - Added additional sanity checks for valid FAT32/FAT16/FAT12 cluster number. - FAT32: check if root directory starts with a valid cluster number, moved from dir.c. There is no point to proceed if the filesystem is already damaged beyond repair. sbin/fsck_msdosfs/check.c: - Combine phase 1 and phase 2, now that the readfat() is able to detect cross chains. sbin/fsck_msdosfs/dir.c: - Refactor code to use FAT accessor instead of accessing the internal representation of FAT table. - Make use of the cluster chain head bitmap. - Clarify and simplify directory entry check, remove unnecessary checks that are would be done at a later time (for example, whether the directory's second cluster is a valid one, which is examined more throughly in a later checkchain() and does not prevent us from proceeding further). sbin/fsck_msdosfs/dosfs.h: - Remove internal representation of FAT table, which is replaced by the head bitmap that is opaque to other code. - Added a special CLUST_DEAD cluster type to indicate errors. sbin/fsck_msdosfs/ext.h: - Added a flag that overrides mmap(2) setting. The corresponding command line option, -M is intentionally undocumented as we do not expect users to need it. - Added accessors for FAT table and convert existing interface to use it. sbin/fsck_msdosfs/fat.c: - Added head bitmap to represent whether a cluster is a head cluster. - Converted FAT internal representation to accessors. - Implemented a LRU cache for FAT32 when mmap(2) should not or can not be used. - _readfat: Attempt a mmap(2) and fall back to regular read for non-FAT32 file systems; use the LRU cache for FAT32 and prepopulate the cache with the first 4MiB of the entries. - readfat: Added support of head bitmap and use the population scan to detect bogus chains. - clusterdiff: removed, FATs are copied from the checked copy via writefat()/copyfat(). - checkchain: calculates the length of a cluster chain and make sure that it ends with a valid EOF marker. - clearchain: follow and clear a chain and maintain the free cluster count. - checklost: convert to use head bitmap. At the end of all other scans, the remaining 'head' nodes are leaders of lost cluster chains. sbin/fsck_msdosfs/fat.c: - Added a new -M option which is intentionally undocumented, to disable the use of mmap(). Reviewed by: kevlo MFC after: 1 month Relnotes: yes Differential Revision: https://reviews.freebsd.org/D22965 Notes: svn path=/head/; revision=356249
* Avoid mixing cluster numbers and sector numbers. Makes code more readable.Xin LI2019-09-153-11/+19
| | | | | | | | Obtained from: NetBSD MFC after: 2 weeks Notes: svn path=/head/; revision=352364
* Correct overflow logic in fullpath().Xin LI2019-09-041-9/+13
| | | | | | | | Obtained from: OpenBSD MFC after: 3 days Notes: svn path=/head/; revision=351802
* Remove unneeded blank line. No functional change.Xin LI2019-08-301-1/+0
| | | | | | | MFC after: 2 weeks Notes: svn path=/head/; revision=351623
* Comment boot block checks and perform additional sanity checks:Xin LI2019-08-261-62/+109
| | | | | | | | | | | | | | | | | | | | | | | The following checks are now being enforced: - bpbBytesPerSec: only accept 512, 1024, 2048 and 4096. - bpbSecPerClust: only accept 1, 2, 4, 8, 16, 32, 64 and 128. - bpbResSectors: require non-zero. - bpbFATs: require non-zero. - bpbSectors: require zero for FAT32. - bpbFATsmall: require zero for FAT32. - bpbHugeSectors: require non-zero for FAT32. Bail out if the BPB contained values that do not meet these requirements. We also require FATsecs * FATsecs to not overflow 32-bit unsigned integer. Check for backup boot block was removed because the checker does not take corrective action, and msdosfs driver ignores it too. Notes: svn path=/head/; revision=351502
* Use calloc().Xin LI2019-08-191-12/+12
| | | | | | | MFC after: 2 weeks Notes: svn path=/head/; revision=351205
* Remove redundant check and wrong fix: fat.c checks already take careXin LI2019-08-191-19/+3
| | | | | | | | | | about cluster chains. Obtained from: OpenBSD MFC after: 2 weeks Notes: svn path=/head/; revision=351204
* In ask(): override default option if any of alwaysyes/alwaysno/rdonly isXin LI2019-06-151-5/+6
| | | | | | | | | set. MFC after: 2 weeks Notes: svn path=/head/; revision=349048
* Blankspace. No actual code change.Xin LI2019-06-151-2/+2
| | | | | | | MFC after: 2 weeks Notes: svn path=/head/; revision=349047
* Avoid out of boundary access when checking invalid long filenames.Xin LI2019-06-111-0/+9
| | | | | | | | Obtained from: OpenBSD (dir.c,v 1.25) MFC after: 3 days Notes: svn path=/head/; revision=348967
* preen should work independently with alwaysyes and alwaysno.Xin LI2019-06-071-3/+2
| | | | | | | | PR: 238375 MFC after: 2 weeks Notes: svn path=/head/; revision=348767
* Don't increment cl after increment.Xin LI2019-06-041-2/+2
| | | | | | | MFC after: 3 days Notes: svn path=/head/; revision=348602
* Don't cast result from malloc().Xin LI2019-04-151-2/+2
| | | | | | | MFC after: 2 weeks Notes: svn path=/head/; revision=346220
* Write string constant differently to improve readability.Xin LI2019-04-061-4/+2
| | | | | | | | | | Reported by: rgrimes Reviewed by: rgrimes, emaste MFC after: 13 days Differential Revision: https://reviews.freebsd.org/D19829 Notes: svn path=/head/; revision=345976
* Fix build.Xin LI2019-04-051-1/+1
| | | | | | | | MFC after: 2 weeks X-MFC-With: r345900 Notes: svn path=/head/; revision=345901
* Implement checking of `.' and `..' entries of subdirectory.Xin LI2019-04-051-3/+101
| | | | | | | | | | Reviewed by: pfg Obtained from: Android https://android.googlesource.com/platform/external/fsck_msdos/+/b6ee08aadb580341a4d80943741b80de16a88b5d%5E%21/ MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D19824 Notes: svn path=/head/; revision=345900
* Restore lfcl when LOSTDIR's chain was corrupted and overwrittenXin LI2019-04-041-0/+1
| | | | | | | | | | with invalid value. Obtained from: Android https://android.googlesource.com/platform/external/fsck_msdos/+/4d6d6f8a3674ad67f970e2ae908d34f64e4854cf%5E%21/ MFC after: 2 weeks Notes: svn path=/head/; revision=345897
* Restore the ability of checking and fixing next freeXin LI2019-04-041-0/+14
| | | | | | | | | | cluster in FSINFO that was lost in r203872. Obtained from: NetBSD MFC after: 2 weeks Notes: svn path=/head/; revision=345894
* Assert that q can't be NULL. 'empty' is always non-NULL when DIREMPTYXin LI2019-04-031-1/+3
| | | | | | | | | is set earlier. MFC after: 1 month Notes: svn path=/head/; revision=345839
* Distinguish between lseek errors and read errores.Xin LI2019-03-281-4/+11
| | | | | | | MFC after: 2 weeks Notes: svn path=/head/; revision=345647
* Detect and handle invalid number of FATsXin LI2018-07-131-0/+4
| | | | | | | | | | | If the number of FATs field in the boot sector is zero, give an appropriate error code. Obtained from: Android https://android.googlesource.com/platform/external/fsck_msdos/+/6c29bbe8d58e6fe8755935a04166ecf82ff31f47%5E%21/ MFC after: 2 weeks Notes: svn path=/head/; revision=336236
* Revert Makefile@335696 that sneaked into the commit.Xin LI2018-06-271-2/+0
| | | | | | | | X-MFC with: 335696 MFC after: 2 weeks Notes: svn path=/head/; revision=335697
* Detect exFAT filesystems and abort if found and tighten BPB sanityXin LI2018-06-272-5/+23
| | | | | | | | | | check. Obtained from: Android https://android-review.googlesource.com/61827 MFC after: 2 weeks Notes: svn path=/head/; revision=335696
* Fix division by zero when reading boot block by postponing divisionXin LI2018-06-261-6/+6
| | | | | | | | | | | until it is necessary and after we validated bytes per sector is non- zero. Obtained from: Android https://android-review.googlesource.com/c/platform/external/fsck_msdos/+/36362 MFC after: 2 weeks Notes: svn path=/head/; revision=335655
* Don't bail out when we find primary and secondary bootblocks miscompare.Xin LI2018-06-221-2/+2
| | | | | | | | | | | | | | | We do not have code to fix this situation, and the mismatch does not prevent the kernel driver from consuming the file system, and some factory formatted SD cards seem to have a garbage backup block. This makes the code match to its comments (replacing pfatal with pwarn). Inspired by: NetBSD r1.13 Inspired by: https://android.googlesource.com/platform/external/fsck_msdos/+/b47b16353f3db228711dded9f7c975b820059ddc MFC after: 2 weeks Notes: svn path=/head/; revision=335559
* Don't bail out from the check if readboot() returns !FSFATAL.Xin LI2018-04-301-1/+1
| | | | | | | | | | | | | | | This can happen when the fsinfo signature is invalid, and the user have choose to fix it, in which case the code would return FSBOOTMOD (not FSOK but not FSFATAL either). All other (fatal) cases would return FSFATAL. Obtained from: Android Open Source Project Obtained from: https://android.googlesource.com/platform/external/fsck_msdos/+/d8775a29ea7eac2e5f1504dd21da3725b93b3036 MFC after: 2 weeks Notes: svn path=/head/; revision=333098
* Prevent OOB access on corrupted msdos directories.Xin LI2017-11-301-1/+1
| | | | | | | | Submitted by: Veo Zhang <veo live com> MFC after: 2 weeks Notes: svn path=/head/; revision=326391
* various: general adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-277-7/+21
| | | | | | | | | | | | | | | | | Mainly focus on files that use BSD 2-Clause license, however the tool I was using misidentified many licenses so this was mostly a manual - error prone - task. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. No functional change intended. Notes: svn path=/head/; revision=326276
* DIRDEPS_BUILD: Update dependencies.Bryan Drewery2017-10-311-1/+0
| | | | | | | Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=325188
* sbin: normalize paths using SRCTOP-relative paths or :H when possibleEnji Cooper2017-03-041-1/+1
| | | | | | | | | | This simplifies make logic/output MFC after: 1 month Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=314656
* Mention the version of NetBSD the utility originated from.Sevan Janiyan2016-10-021-2/+5
| | | | | | | | | | PR: 212476 Approved by: bcr (mentor) MFC after: 4 days Differential Revision: https://reviews.freebsd.org/D8105 Notes: svn path=/head/; revision=306602
* fsck_msdosfs: Adjust a check.Pedro F. Giffuni2016-05-041-1/+1
| | | | | | | | | | | The on-disk FAT array does not include anything before CLUST_FIRST, compensate in size check. Obtained from: NetBSD (CVS Rev. 1.20) MFC after: 2 weeks Notes: svn path=/head/; revision=299089
* Use macro MAX() from sys/param.h.Marcelo Araujo2016-04-221-1/+1
| | | | | | | MFC after: 2 weeks. Notes: svn path=/head/; revision=298441
* fsck_msdosfs: use NULL instead of zero for pointers.Pedro F. Giffuni2016-04-191-1/+1
| | | | Notes: svn path=/head/; revision=298286
* MFHGlen Barber2016-04-111-4/+6
|\ | | | | | | | | | | | | Sponsored by: The FreeBSD Foundation Notes: svn path=/projects/release-pkg/; revision=297824