scsi: 53c700: Fix hostdata[] size on 64-bit
PATCH 1/1 scsi: 53c700: Fix hostdata[] size on 64-bit
From: Geert Uytterhoeven <[email protected]>
NCR_700_detect() allocates four bytes for a single-entry hostdata array, to store the NCR_700_Host_Parameters pointer. However, hostdata is an array of unsigned longs, thus storing a pointer or unsigned long causes a buffer overflow on 64-bit platforms.
---
Compile-tested only.
CONFIG_SCSI_LASI700 is used on PA-RISC 64-bit, CONFIG_SCSI_SIM710 might be used on Alpha with EISA.
--- drivers/scsi/53c700.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/53c700.c +1 -1
@@ -341,7 +341,7 @@ NCR_700_detect(struct scsi_host_template *tpnt,if (tpnt->proc_name ==NULL ) tpnt->proc_name ="53c700" ; - host =scsi_host_alloc (tpnt,4 ); + host =scsi_host_alloc (tpnt,sizeof (unsigned long ));if (!host)return NULL ; memset(hostdata->slots, 0, sizeof(struct NCR_700_command_slot)
Signature · 1 line
2.43.0
Geert,
Quoted 4 lines
NCR_700_detect()allocates four bytes for a single-entry hostdata array, to store theNCR_700_Host_Parameterspointer. However, hostdata is an array of unsigned longs, thus storing a pointer or unsigned long causes a buffer overflow on 64-bit platforms.
Applied to 7.5/scsi-staging, thanks!
Signature · 1 line
Martin K. Petersen