• Joe Lawrence's avatar
    mpt2sas: correct scsi_{target,device} hostdata allocation · feafe7c5
    Joe Lawrence authored
    In _scsih_{slave,target}_alloc, an incorrect structure type is passed
    to sizeof() when allocating storage for hostdata.  Luckily larger
    structure types were used, so at least the wrong sizes were safe:
    
      struct scsi_device (1784 bytes) > struct MPT2SAS_DEVICE (24 bytes)
      struct scsi_target (760 bytes)  > struct MPT2SAS_TARGET (40 bytes)
    
    This fixes the following smatch warnings:
    
      drivers/scsi/mpt2sas/mpt2sas_scsih.c:1295 _scsih_target_alloc()
        warn: struct type mismatch 'MPT2SAS_TARGET vs scsi_target'
    
      drivers/scsi/mpt2sas/mpt2sas_scsih.c:1409 _scsih_slave_alloc()
        warn: struct type mismatch 'MPT2SAS_DEVICE vs scsi_device'
    Signed-off-by: default avatarJoe Lawrence <joe.lawrence@stratus.com>
    Acked-by: default avatarSreekanth Reddy <Sreekanth.Reddy@avagotech.com>
    Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
    feafe7c5
mpt2sas_scsih.c 245 KB