]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
mpt2sas: correct scsi_{target,device} hostdata allocation
authorJoe Lawrence <joe.lawrence@stratus.com>
Wed, 25 Jun 2014 21:03:14 +0000 (17:03 -0400)
committerChristoph Hellwig <hch@lst.de>
Fri, 25 Jul 2014 21:16:56 +0000 (17:16 -0400)
commitfeafe7c596f62123e1d24f1399e1d40c61e9d9d6
tree3bbef29d58a741b19bbc5c25b33d73e3dc3170b1
parent4bfaa5c4b99ddec00907e854d70453bd2aef39a0
mpt2sas: correct scsi_{target,device} hostdata allocation

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: Joe Lawrence <joe.lawrence@stratus.com>
Acked-by: Sreekanth Reddy <Sreekanth.Reddy@avagotech.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
drivers/scsi/mpt2sas/mpt2sas_scsih.c