History log of /freebsd-10-stable/sys/fs/msdosfs/msdosfs_fat.c
Revision Date Author Comments
# 338180 22-Aug-2018 pfg

MFC r337456:
msdosfs: fixes for Undefined Behavior.

These were found by the Undefined Behaviour GsoC project at NetBSD:

Do not change signedness bit with left shift.
While there avoid signed integer overflow.
Address both issues with using unsigned type.

msdosfs_fat.c:512:42, left shift of 1 by 31 places cannot be represented
in type 'int'
msdosfs_fat.c:521:44, left shift of 1 by 31 places cannot be represented
in type 'int'
msdosfs_fat.c:744:14, left shift of 1 by 31 places cannot be represented
in type 'int'
msdosfs_fat.c:744:24, signed integer overflow: -2147483648 - 1 cannot be
represented in type 'int [20]'
msdosfs_fat.c:840:13, left shift of 1 by 31 places cannot be represented
in type 'int'
msdosfs_fat.c:840:36, signed integer overflow: -2147483648 - 1 cannot be
represented in type 'int [20]'

Detected with micro-UBSan in the user mode.

Hinted from: NetBSD (CVS 1.33)


# 308551 11-Nov-2016 kib

MFC r308024:
Ensure that cluster allocations never allocate clusters outside the
volume limits.


# 308550 11-Nov-2016 kib

MFC r308023:
If the fatchain() call in chainalloc() returned an error, revert
marking the cluster run as in-use.


# 308549 11-Nov-2016 kib

MFC r308022:
Use symbolic name for the value of fully free word in pm_inusemap.


# 308548 11-Nov-2016 kib

MFC r308021:
Use symbolic name for the free cluster number.


# 308547 11-Nov-2016 kib

MFC r308020:
Fix comment formatting.


# 281456 12-Apr-2015 kib

MFC r281120:
Assert that an msdosfs mount is not read-only when FAT modifications
are requested.


# 281456 12-Apr-2015 kib

MFC r281120:
Assert that an msdosfs mount is not read-only when FAT modifications
are requested.