From 9d1bccac8f1090a51468fddccfeb6e0c92bcb9ca Mon Sep 17 00:00:00 2001 From: Soumyajyotii Ssarkar Date: Tue, 4 Nov 2025 00:10:30 +0530 Subject: [PATCH] ncr710: Fix potential null pointer dereference The code dereferences s->current before checking if it is NULL. Move the null check before the dereference to prevent potential crashes. This issue could occur if s->current is NULL when the function reaches the "Host adapter (re)connected" path, though this should not normally happen during correct operation. Reported-by: Stefan Hajnoczi Reported-by: GuoHan Zhao Suggested-by: GuoHan Zhao Signed-off-by: Soumyajyotii Ssarkar Reviewed-by: Helge Deller Signed-off-by: Helge Deller --- hw/scsi/ncr53c710.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/hw/scsi/ncr53c710.c b/hw/scsi/ncr53c710.c index ade951b1d1..a35c41b67f 100644 --- a/hw/scsi/ncr53c710.c +++ b/hw/scsi/ncr53c710.c @@ -832,12 +832,11 @@ void ncr710_transfer_data(SCSIRequest *req, uint32_t len) } /* Host adapter (re)connected */ - s->current->dma_len = len; s->command_complete = NCR710_CMD_DATA_READY; - if (!s->current) { return; } + s->current->dma_len = len; if (s->waiting) { s->scntl1 |= NCR710_SCNTL1_CON; -- 2.47.3