]> git.ipfire.org Git - thirdparty/qemu.git/commit
hw/ide/core.c (cmd_read_native_max): Avoid limited device parameters
authorLev Kujawski <lkujaw@mailbox.org>
Mon, 10 Oct 2022 08:52:28 +0000 (08:52 +0000)
committerThomas Huth <thuth@redhat.com>
Tue, 30 Apr 2024 04:21:47 +0000 (06:21 +0200)
commit8682ff696050584cfcb5bf43d567680ad339cf41
tree87a4cb9ca4e19bd743e8a5cad6af4f3d5e515b3c
parent39ad72c2600af53d7697413afac382562910d3f8
hw/ide/core.c (cmd_read_native_max): Avoid limited device parameters

Always use the native CHS device parameters for the ATA commands READ
NATIVE MAX ADDRESS and READ NATIVE MAX ADDRESS EXT, not those limited
by the ATA command INITIALIZE_DEVICE_PARAMETERS (introduced in patch
176e4961, hw/ide/core.c: Implement ATA INITIALIZE_DEVICE_PARAMETERS
command, 2022-07-07.)

As stated by the ATA/ATAPI specification, "[t]he native maximum is the
highest address accepted by the device in the factory default
condition."  Therefore this patch substitutes the native values in
drive_heads and drive_sectors before calling ide_set_sector().

One consequence of the prior behavior was that setting zero sectors
per track could lead to an FPE within ide_set_sector().  Thanks to
Alexander Bulekov for reporting this issue.

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1243
Signed-off-by: Lev Kujawski <lkujaw@mailbox.org>
Message-ID: <20221010085229.2431276-1-lkujaw@mailbox.org>
Signed-off-by: Thomas Huth <thuth@redhat.com>
hw/ide/core.c