FDOS / kernel

FreeDOS kernel - implements the core MS-DOS/PC-DOS (R) compatible operating system. It is derived from Pat Villani's DOS-C kernel and released under the GPL v2 or later. Please see http://www.freedos.org/ for more details about the FreeDOS (TM) Project.
http://kernel.fdos.org/
GNU General Public License v2.0
811 stars 144 forks source link

initdisk: fix CHS plausibility check, exeflat: fix compiler warning #109

Closed boeckmann closed 11 months ago

boeckmann commented 1 year ago

initdisk: fix CHS plausibility check for disks with virt. cyl. 0xffff

In initdisk.c, CHS values of partition table entries undergo a plausibility check via the is_suspect() function. The values are compared with values derived from the LBA values stored in the partition table.

These derived values contain a "virtual" cylinder count. For very large disks, instead of overflowing, this virtual cylinder value is set to its maximum 16-bit value of 0xffff. However, this makes the following plausibility check performed by is_suspect() fail.

The "fix" is, that for the virtual cylinder value of 0xffff, the plausibility check is disabled, preventing false-positive warnings at boot.

exepack: fix uninitialized use of reloc variable, compiler warning

While header->exRelocItems should be zero and therefore the call to qsort be safe, this should be pulled into the if branch. Even if it is only for the sake of getting rid of the compiler warning.

boeckmann commented 1 year ago

In case you wonder: have mixed up the words exeflat and exepack in the comment, so re-committed.