Plug the rest of undef behavior places that were missed in r337456.
There are three more places in msdosfs_fat.c which might shift one into the sign bit. While there, fix formatting of KASSERTs. Sponsored by: The FreeBSD Foundation MFC after: 1 week
This commit is contained in:
parent
4dc5c02c01
commit
53fcc6c960
@ -388,9 +388,10 @@ usemap_alloc(struct msdosfsmount *pmp, u_long cn)
|
||||
pmp->pm_maxcluster));
|
||||
KASSERT((pmp->pm_flags & MSDOSFSMNT_RONLY) == 0,
|
||||
("usemap_alloc on ro msdosfs mount"));
|
||||
KASSERT((pmp->pm_inusemap[cn / N_INUSEBITS] & (1 << (cn % N_INUSEBITS)))
|
||||
== 0, ("Allocating used sector %ld %ld %x", cn, cn % N_INUSEBITS,
|
||||
(unsigned)pmp->pm_inusemap[cn / N_INUSEBITS]));
|
||||
KASSERT((pmp->pm_inusemap[cn / N_INUSEBITS] &
|
||||
(1U << (cn % N_INUSEBITS))) == 0,
|
||||
("Allocating used sector %ld %ld %x", cn, cn % N_INUSEBITS,
|
||||
(unsigned)pmp->pm_inusemap[cn / N_INUSEBITS]));
|
||||
pmp->pm_inusemap[cn / N_INUSEBITS] |= 1U << (cn % N_INUSEBITS);
|
||||
KASSERT(pmp->pm_freeclustercount > 0, ("usemap_alloc: too little"));
|
||||
pmp->pm_freeclustercount--;
|
||||
@ -409,9 +410,10 @@ usemap_free(struct msdosfsmount *pmp, u_long cn)
|
||||
("usemap_free on ro msdosfs mount"));
|
||||
pmp->pm_freeclustercount++;
|
||||
pmp->pm_flags |= MSDOSFS_FSIMOD;
|
||||
KASSERT((pmp->pm_inusemap[cn / N_INUSEBITS] & (1 << (cn % N_INUSEBITS)))
|
||||
!= 0, ("Freeing unused sector %ld %ld %x", cn, cn % N_INUSEBITS,
|
||||
(unsigned)pmp->pm_inusemap[cn / N_INUSEBITS]));
|
||||
KASSERT((pmp->pm_inusemap[cn / N_INUSEBITS] &
|
||||
(1U << (cn % N_INUSEBITS))) != 0,
|
||||
("Freeing unused sector %ld %ld %x", cn, cn % N_INUSEBITS,
|
||||
(unsigned)pmp->pm_inusemap[cn / N_INUSEBITS]));
|
||||
pmp->pm_inusemap[cn / N_INUSEBITS] &= ~(1U << (cn % N_INUSEBITS));
|
||||
}
|
||||
|
||||
@ -648,7 +650,7 @@ chainlength(struct msdosfsmount *pmp, u_long start, u_long count)
|
||||
idx = start / N_INUSEBITS;
|
||||
start %= N_INUSEBITS;
|
||||
map = pmp->pm_inusemap[idx];
|
||||
map &= ~((1 << start) - 1);
|
||||
map &= ~((1U << start) - 1);
|
||||
if (map) {
|
||||
len = ffs(map) - 1 - start;
|
||||
len = MIN(len, count);
|
||||
|
Loading…
x
Reference in New Issue
Block a user