mirror of
https://github.com/SCST-project/scst.git
synced 2026-05-20 04:01:26 +00:00
qla2x00t-32gbit: Fix potential NULL pointer dereference
Klocwork tool reported 'cur_dsd' may be dereferenced. Add fix to validate pointer before dereferencing the pointer. Cc: stable@vger.kernel.org Signed-off-by: Bikash Hazarika <bhazarika@marvell.com> Signed-off-by: Nilesh Javali <njavali@marvell.com> Link: https://lore.kernel.org/r/20230607113843.37185-3-njavali@marvell.com Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> [ commit 464ea494a40c upstream ]
This commit is contained in:
@@ -613,7 +613,8 @@ qla24xx_build_scsi_type_6_iocbs(srb_t *sp, struct cmd_type_6 *cmd_pkt,
|
||||
put_unaligned_le32(COMMAND_TYPE_6, &cmd_pkt->entry_type);
|
||||
|
||||
/* No data transfer */
|
||||
if (!scsi_bufflen(cmd) || cmd->sc_data_direction == DMA_NONE) {
|
||||
if (!scsi_bufflen(cmd) || cmd->sc_data_direction == DMA_NONE ||
|
||||
tot_dsds == 0) {
|
||||
cmd_pkt->byte_count = cpu_to_le32(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user