aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/mpt2sas/mpt2sas_scsih.c
diff options
context:
space:
mode:
authornagalakshmi.nandigama@lsi.com <nagalakshmi.nandigama@lsi.com>2012-03-20 02:37:17 -0400
committerJames Bottomley <JBottomley@Parallels.com>2012-04-23 14:27:21 -0400
commit298c794def0631763ec861e641a448c7decf73bb (patch)
treef22b4ccd7cab935907505322dd0eab330c96a480 /drivers/scsi/mpt2sas/mpt2sas_scsih.c
parent09da0b32d078a3b94aa6d948d053b84755712a2b (diff)
[SCSI] mpt2sas: Fix security scan issues reported by source code analysis tool
Modified the source code as per the findings reported by the source code analysis tool. Source code for the following functionalities has been touched. None of the driver functionalities has changed. - SMP Passthrough IOCTL - Debug messages for MPT Replies (i.e. bit 9 of Logging Level) - Task Management using sysfs - Device removal, i.e. when a target device (including any PD within a volume) is removed, and Volume Deletion. - Trace Buffer Signed-off-by: Nagalakshmi Nandigama <nagalakshmi.nandigama@lsi.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi/mpt2sas/mpt2sas_scsih.c')
-rw-r--r--drivers/scsi/mpt2sas/mpt2sas_scsih.c38
1 files changed, 28 insertions, 10 deletions
diff --git a/drivers/scsi/mpt2sas/mpt2sas_scsih.c b/drivers/scsi/mpt2sas/mpt2sas_scsih.c
index 9a739e6f2712..9de474051507 100644
--- a/drivers/scsi/mpt2sas/mpt2sas_scsih.c
+++ b/drivers/scsi/mpt2sas/mpt2sas_scsih.c
@@ -3186,16 +3186,19 @@ static u8
3186_scsih_sas_control_complete(struct MPT2SAS_ADAPTER *ioc, u16 smid, 3186_scsih_sas_control_complete(struct MPT2SAS_ADAPTER *ioc, u16 smid,
3187 u8 msix_index, u32 reply) 3187 u8 msix_index, u32 reply)
3188{ 3188{
3189#ifdef CONFIG_SCSI_MPT2SAS_LOGGING
3190 Mpi2SasIoUnitControlReply_t *mpi_reply = 3189 Mpi2SasIoUnitControlReply_t *mpi_reply =
3191 mpt2sas_base_get_reply_virt_addr(ioc, reply); 3190 mpt2sas_base_get_reply_virt_addr(ioc, reply);
3192#endif 3191 if (likely(mpi_reply)) {
3193 dewtprintk(ioc, printk(MPT2SAS_INFO_FMT 3192 dewtprintk(ioc, printk(MPT2SAS_INFO_FMT
3194 "sc_complete:handle(0x%04x), (open) " 3193 "sc_complete:handle(0x%04x), (open) "
3195 "smid(%d), ioc_status(0x%04x), loginfo(0x%08x)\n", 3194 "smid(%d), ioc_status(0x%04x), loginfo(0x%08x)\n",
3196 ioc->name, le16_to_cpu(mpi_reply->DevHandle), smid, 3195 ioc->name, le16_to_cpu(mpi_reply->DevHandle), smid,
3197 le16_to_cpu(mpi_reply->IOCStatus), 3196 le16_to_cpu(mpi_reply->IOCStatus),
3198 le32_to_cpu(mpi_reply->IOCLogInfo))); 3197 le32_to_cpu(mpi_reply->IOCLogInfo)));
3198 } else {
3199 printk(MPT2SAS_ERR_FMT "mpi_reply not valid at %s:%d/%s()!\n",
3200 ioc->name, __FILE__, __LINE__, __func__);
3201 }
3199 return 1; 3202 return 1;
3200} 3203}
3201 3204
@@ -3274,7 +3277,11 @@ _scsih_tm_volume_tr_complete(struct MPT2SAS_ADAPTER *ioc, u16 smid,
3274 "progress!\n", __func__, ioc->name)); 3277 "progress!\n", __func__, ioc->name));
3275 return 1; 3278 return 1;
3276 } 3279 }
3277 3280 if (unlikely(!mpi_reply)) {
3281 printk(MPT2SAS_ERR_FMT "mpi_reply not valid at %s:%d/%s()!\n",
3282 ioc->name, __FILE__, __LINE__, __func__);
3283 return 1;
3284 }
3278 mpi_request_tm = mpt2sas_base_get_msg_frame(ioc, smid); 3285 mpi_request_tm = mpt2sas_base_get_msg_frame(ioc, smid);
3279 handle = le16_to_cpu(mpi_request_tm->DevHandle); 3286 handle = le16_to_cpu(mpi_request_tm->DevHandle);
3280 if (handle != le16_to_cpu(mpi_reply->DevHandle)) { 3287 if (handle != le16_to_cpu(mpi_reply->DevHandle)) {
@@ -3337,7 +3344,11 @@ _scsih_tm_tr_complete(struct MPT2SAS_ADAPTER *ioc, u16 smid, u8 msix_index,
3337 "operational\n", __func__, ioc->name)); 3344 "operational\n", __func__, ioc->name));
3338 return 1; 3345 return 1;
3339 } 3346 }
3340 3347 if (unlikely(!mpi_reply)) {
3348 printk(MPT2SAS_ERR_FMT "mpi_reply not valid at %s:%d/%s()!\n",
3349 ioc->name, __FILE__, __LINE__, __func__);
3350 return 1;
3351 }
3341 mpi_request_tm = mpt2sas_base_get_msg_frame(ioc, smid); 3352 mpi_request_tm = mpt2sas_base_get_msg_frame(ioc, smid);
3342 handle = le16_to_cpu(mpi_request_tm->DevHandle); 3353 handle = le16_to_cpu(mpi_request_tm->DevHandle);
3343 if (handle != le16_to_cpu(mpi_reply->DevHandle)) { 3354 if (handle != le16_to_cpu(mpi_reply->DevHandle)) {
@@ -7353,6 +7364,13 @@ mpt2sas_scsih_event_callback(struct MPT2SAS_ADAPTER *ioc, u8 msix_index,
7353 return 1; 7364 return 1;
7354 7365
7355 mpi_reply = mpt2sas_base_get_reply_virt_addr(ioc, reply); 7366 mpi_reply = mpt2sas_base_get_reply_virt_addr(ioc, reply);
7367
7368 if (unlikely(!mpi_reply)) {
7369 printk(MPT2SAS_ERR_FMT "mpi_reply not valid at %s:%d/%s()!\n",
7370 ioc->name, __FILE__, __LINE__, __func__);
7371 return 1;
7372 }
7373
7356 event = le16_to_cpu(mpi_reply->Event); 7374 event = le16_to_cpu(mpi_reply->Event);
7357 7375
7358 switch (event) { 7376 switch (event) {