mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 00:03:54 -06:00
megasas: do not read sense length more than once from frame
Avoid TOC-TOU bugs depending on how the compiler behaves. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
660174fc1b
commit
134550bf81
1 changed files with 4 additions and 2 deletions
|
@ -309,9 +309,11 @@ static int megasas_build_sense(MegasasCmd *cmd, uint8_t *sense_ptr,
|
|||
PCIDevice *pcid = PCI_DEVICE(cmd->state);
|
||||
uint32_t pa_hi = 0, pa_lo;
|
||||
hwaddr pa;
|
||||
int frame_sense_len;
|
||||
|
||||
if (sense_len > cmd->frame->header.sense_len) {
|
||||
sense_len = cmd->frame->header.sense_len;
|
||||
frame_sense_len = cmd->frame->header.sense_len;
|
||||
if (sense_len > frame_sense_len) {
|
||||
sense_len = frame_sense_len;
|
||||
}
|
||||
if (sense_len) {
|
||||
pa_lo = le32_to_cpu(cmd->frame->pass.sense_addr_lo);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue