* [PATCH 0/4] mpt2/mpt3 static checker fixups @ 2014-06-02 14:34 Joe Lawrence 2014-06-02 14:34 ` [PATCH 1/4] mpt2sas: correct scsi_{target,device} hostdata allocation Joe Lawrence ` (5 more replies) 0 siblings, 6 replies; 13+ messages in thread From: Joe Lawrence @ 2014-06-02 14:34 UTC (permalink / raw) To: linux-scsi; +Cc: Dan Carpenter, Sreekanth Reddy, Joe Lawrence Hello Sreekanth, Dan, These are a few minor smatch and sparse static checker fixes for the LSI mpt2 and mpt3 drivers. The first three fix real potential bugs and the last cleans up a noisy complaint from sparse. Joe Lawrence (4): mpt2sas: correct scsi_{target,device} hostdata allocation mpt3sas: correct scsi_{target,device} hostdata allocation mpt3sas: fix possible memory leak in mpt3sas_send_trigger_data_event mpt2sas: annotate ioc->reply_post_host_index as __iomem drivers/scsi/mpt2sas/mpt2sas_base.c | 9 +++++---- drivers/scsi/mpt2sas/mpt2sas_base.h | 2 +- drivers/scsi/mpt2sas/mpt2sas_scsih.c | 6 ++++-- drivers/scsi/mpt3sas/mpt3sas_scsih.c | 10 +++++++--- 4 files changed, 17 insertions(+), 10 deletions(-) -- 1.7.10.4 ^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 1/4] mpt2sas: correct scsi_{target,device} hostdata allocation 2014-06-02 14:34 [PATCH 0/4] mpt2/mpt3 static checker fixups Joe Lawrence @ 2014-06-02 14:34 ` Joe Lawrence 2014-06-02 16:30 ` Christoph Hellwig 2014-06-02 14:37 ` [PATCH 3/4] mpt3sas: fix possible memory leak in mpt3sas_send_trigger_data_event Joe Lawrence ` (4 subsequent siblings) 5 siblings, 1 reply; 13+ messages in thread From: Joe Lawrence @ 2014-06-02 14:34 UTC (permalink / raw) To: linux-scsi; +Cc: Dan Carpenter, Sreekanth Reddy, Joe Lawrence 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> Cc: Dan Carpenter <dan.carpenter@oracle.com> Cc: Sreekanth Reddy <Sreekanth.Reddy@lsi.com> --- drivers/scsi/mpt2sas/mpt2sas_scsih.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/mpt2sas/mpt2sas_scsih.c b/drivers/scsi/mpt2sas/mpt2sas_scsih.c index 6fd7d40..deb0bd2 100644 --- a/drivers/scsi/mpt2sas/mpt2sas_scsih.c +++ b/drivers/scsi/mpt2sas/mpt2sas_scsih.c @@ -1292,7 +1292,8 @@ _scsih_target_alloc(struct scsi_target *starget) unsigned long flags; struct sas_rphy *rphy; - sas_target_priv_data = kzalloc(sizeof(struct scsi_target), GFP_KERNEL); + sas_target_priv_data = kzalloc(sizeof(*sas_target_priv_data), + GFP_KERNEL); if (!sas_target_priv_data) return -ENOMEM; @@ -1406,7 +1407,8 @@ _scsih_slave_alloc(struct scsi_device *sdev) struct _sas_device *sas_device; unsigned long flags; - sas_device_priv_data = kzalloc(sizeof(struct scsi_device), GFP_KERNEL); + sas_device_priv_data = kzalloc(sizeof(*sas_device_priv_data), + GFP_KERNEL); if (!sas_device_priv_data) return -ENOMEM; -- 1.7.10.4 ^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH 1/4] mpt2sas: correct scsi_{target,device} hostdata allocation 2014-06-02 14:34 ` [PATCH 1/4] mpt2sas: correct scsi_{target,device} hostdata allocation Joe Lawrence @ 2014-06-02 16:30 ` Christoph Hellwig 0 siblings, 0 replies; 13+ messages in thread From: Christoph Hellwig @ 2014-06-02 16:30 UTC (permalink / raw) To: Joe Lawrence; +Cc: linux-scsi, Dan Carpenter, Sreekanth Reddy Looks good, Reviewed-by: Christoph Hellwig <hch@lst.de> ^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 3/4] mpt3sas: fix possible memory leak in mpt3sas_send_trigger_data_event 2014-06-02 14:34 [PATCH 0/4] mpt2/mpt3 static checker fixups Joe Lawrence 2014-06-02 14:34 ` [PATCH 1/4] mpt2sas: correct scsi_{target,device} hostdata allocation Joe Lawrence @ 2014-06-02 14:37 ` Joe Lawrence 2014-06-02 16:31 ` Christoph Hellwig 2014-06-02 14:38 ` [PATCH 2/4] mpt3sas: correct scsi_{target,device} hostdata allocation Joe Lawrence ` (3 subsequent siblings) 5 siblings, 1 reply; 13+ messages in thread From: Joe Lawrence @ 2014-06-02 14:37 UTC (permalink / raw) To: linux-scsi; +Cc: Dan Carpenter, Sreekanth Reddy, Joe Lawrence If mpt3sas_send_trigger_data_event exits early without inserting a fw_event, be sure to undo any prior allocations. This fixes the following smatch warning: drivers/scsi/mpt3sas/mpt3sas_scsih.c:2522 mpt3sas_send_trigger_data_event() warn: possible memory leak of 'fw_event' Signed-off-by: Joe Lawrence <joe.lawrence@stratus.com> Cc: Dan Carpenter <dan.carpenter@oracle.com> Cc: Sreekanth Reddy <Sreekanth.Reddy@lsi.com> --- drivers/scsi/mpt3sas/mpt3sas_scsih.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c b/drivers/scsi/mpt3sas/mpt3sas_scsih.c index e6f0720..25e3a22 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c +++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c @@ -2520,8 +2520,10 @@ mpt3sas_send_trigger_data_event(struct MPT3SAS_ADAPTER *ioc, if (!fw_event) return; fw_event->event_data = kzalloc(sizeof(*event_data), GFP_ATOMIC); - if (!fw_event->event_data) + if (!fw_event->event_data) { + kfree(fw_event); return; + } fw_event->event = MPT3SAS_PROCESS_TRIGGER_DIAG; fw_event->ioc = ioc; memcpy(fw_event->event_data, event_data, sizeof(*event_data)); -- 1.7.10.4 ^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH 3/4] mpt3sas: fix possible memory leak in mpt3sas_send_trigger_data_event 2014-06-02 14:37 ` [PATCH 3/4] mpt3sas: fix possible memory leak in mpt3sas_send_trigger_data_event Joe Lawrence @ 2014-06-02 16:31 ` Christoph Hellwig 2014-06-02 20:41 ` Christoph Hellwig <hch@infradead.org> wrote: Joe Lawrence 0 siblings, 1 reply; 13+ messages in thread From: Christoph Hellwig @ 2014-06-02 16:31 UTC (permalink / raw) To: Joe Lawrence; +Cc: linux-scsi, Dan Carpenter, Sreekanth Reddy On Mon, Jun 02, 2014 at 10:37:26AM -0400, Joe Lawrence wrote: > If mpt3sas_send_trigger_data_event exits early without inserting a > fw_event, be sure to undo any prior allocations. Looks good, but why don't we just allocate the two in a single allocation? Reviewed-by: Christoph Hellwig <hch@lst.de> ^ permalink raw reply [flat|nested] 13+ messages in thread
* Christoph Hellwig <hch@infradead.org> wrote: 2014-06-02 16:31 ` Christoph Hellwig @ 2014-06-02 20:41 ` Joe Lawrence 0 siblings, 0 replies; 13+ messages in thread From: Joe Lawrence @ 2014-06-02 20:41 UTC (permalink / raw) To: linux-scsi Cc: Christoph Hellwig, Dan Carpenter, Sreekanth Reddy, Joe Lawrence > On Mon, Jun 02, 2014 at 10:37:26AM -0400, Joe Lawrence wrote: > > If mpt3sas_send_trigger_data_event exits early without inserting a > > fw_event, be sure to undo any prior allocations. > > Looks good, but why don't we just allocate the two in a single > allocation? Hi Christoph, The following routines already handle two allocations safely: mpt2sas_scsih_event_callback mpt3sas_scsih_event_callback but if we wanted to merge them, it could look something like this (introducing a bunch of UglyCamelCaseCastings). Compile tested only... and doesn't include mpt3sas or fusion versions. -- >8 -- >From b34615dfb103613f228a82eb4eb6644a04036256 Mon Sep 17 00:00:00 2001 From: Joe Lawrence <joe.lawrence@stratus.com> Date: Sun, 1 Jun 2014 22:36:45 -0400 Subject: [PATCH] mpt3sas: combine fw_event_work and its event_data Tack the firmware reply event_data payload to the end of its corresponding struct fw_event_work allocation. This fixes the following smatch warning: drivers/scsi/mpt3sas/mpt3sas_scsih.c:2522 mpt3sas_send_trigger_data_event() warn: possible memory leak of 'fw_event' Signed-off-by: Joe Lawrence <joe.lawrence@stratus.com> Cc: Dan Carpenter <dan.carpenter@oracle.com> Cc: Sreekanth Reddy <Sreekanth.Reddy@lsi.com> --- drivers/scsi/mpt3sas/mpt3sas_scsih.c | 54 +++++++++++++++++----------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c b/drivers/scsi/mpt3sas/mpt3sas_scsih.c index e6f0720..8c2aa5d 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c +++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c @@ -190,7 +190,7 @@ struct fw_event_work { u8 VP_ID; u8 ignore; u16 event; - void *event_data; + char event_data[0]; }; /* raid transport support */ @@ -2495,7 +2495,6 @@ _scsih_fw_event_free(struct MPT3SAS_ADAPTER *ioc, struct fw_event_work spin_lock_irqsave(&ioc->fw_event_lock, flags); list_del(&fw_event->list); - kfree(fw_event->event_data); kfree(fw_event); spin_unlock_irqrestore(&ioc->fw_event_lock, flags); } @@ -2516,12 +2515,10 @@ mpt3sas_send_trigger_data_event(struct MPT3SAS_ADAPTER *ioc, if (ioc->is_driver_loading) return; - fw_event = kzalloc(sizeof(struct fw_event_work), GFP_ATOMIC); + fw_event = kzalloc(sizeof(*fw_event) + sizeof(*event_data), + GFP_ATOMIC); if (!fw_event) return; - fw_event->event_data = kzalloc(sizeof(*event_data), GFP_ATOMIC); - if (!fw_event->event_data) - return; fw_event->event = MPT3SAS_PROCESS_TRIGGER_DIAG; fw_event->ioc = ioc; memcpy(fw_event->event_data, event_data, sizeof(*event_data)); @@ -3216,7 +3213,8 @@ _scsih_check_topo_delete_events(struct MPT3SAS_ADAPTER *ioc, if (fw_event->event != MPI2_EVENT_SAS_TOPOLOGY_CHANGE_LIST || fw_event->ignore) continue; - local_event_data = fw_event->event_data; + local_event_data = (Mpi2EventDataSasTopologyChangeList_t *) + &fw_event->event_data; if (local_event_data->ExpStatus == MPI2_EVENT_SAS_TOPO_ES_ADDED || local_event_data->ExpStatus == @@ -5051,7 +5049,8 @@ _scsih_sas_topology_change_event(struct MPT3SAS_ADAPTER *ioc, u64 sas_address; unsigned long flags; u8 link_rate, prev_link_rate; - Mpi2EventDataSasTopologyChangeList_t *event_data = fw_event->event_data; + Mpi2EventDataSasTopologyChangeList_t *event_data = + (Mpi2EventDataSasTopologyChangeList_t *) &fw_event->event_data; #ifdef CONFIG_SCSI_MPT3SAS_LOGGING if (ioc->logging_level & MPT_DEBUG_EVENT_WORK_TASK) @@ -5249,7 +5248,7 @@ _scsih_sas_device_status_change_event(struct MPT3SAS_ADAPTER *ioc, u64 sas_address; unsigned long flags; Mpi2EventDataSasDeviceStatusChange_t *event_data = - fw_event->event_data; + (Mpi2EventDataSasDeviceStatusChange_t *) &fw_event->event_data; #ifdef CONFIG_SCSI_MPT3SAS_LOGGING if (ioc->logging_level & MPT_DEBUG_EVENT_WORK_TASK) @@ -5345,7 +5344,7 @@ _scsih_sas_enclosure_dev_status_change_event(struct MPT3SAS_ADAPTER *ioc, #ifdef CONFIG_SCSI_MPT3SAS_LOGGING if (ioc->logging_level & MPT_DEBUG_EVENT_WORK_TASK) _scsih_sas_enclosure_dev_status_change_event_debug(ioc, - fw_event->event_data); + &fw_event->event_data); #endif } @@ -5369,7 +5368,8 @@ _scsih_sas_broadcast_primitive_event(struct MPT3SAS_ADAPTER *ioc, u32 termination_count; u32 query_count; Mpi2SCSITaskManagementReply_t *mpi_reply; - Mpi2EventDataSasBroadcastPrimitive_t *event_data = fw_event->event_data; + Mpi2EventDataSasBroadcastPrimitive_t *event_data = + (Mpi2EventDataSasBroadcastPrimitive_t *) &fw_event->event_data; u16 ioc_status; unsigned long flags; int r; @@ -5521,7 +5521,8 @@ static void _scsih_sas_discovery_event(struct MPT3SAS_ADAPTER *ioc, struct fw_event_work *fw_event) { - Mpi2EventDataSasDiscovery_t *event_data = fw_event->event_data; + Mpi2EventDataSasDiscovery_t *event_data = + (Mpi2EventDataSasDiscovery_t *) &fw_event->event_data; #ifdef CONFIG_SCSI_MPT3SAS_LOGGING if (ioc->logging_level & MPT_DEBUG_EVENT_WORK_TASK) { @@ -6007,7 +6008,8 @@ _scsih_sas_ir_config_change_event(struct MPT3SAS_ADAPTER *ioc, Mpi2EventIrConfigElement_t *element; int i; u8 foreign_config; - Mpi2EventDataIrConfigChangeList_t *event_data = fw_event->event_data; + Mpi2EventDataIrConfigChangeList_t *event_data = + (Mpi2EventDataIrConfigChangeList_t *) &fw_event->event_data; #ifdef CONFIG_SCSI_MPT3SAS_LOGGING if (ioc->logging_level & MPT_DEBUG_EVENT_WORK_TASK) @@ -6077,7 +6079,8 @@ _scsih_sas_ir_volume_event(struct MPT3SAS_ADAPTER *ioc, u16 handle; u32 state; int rc; - Mpi2EventDataIrVolume_t *event_data = fw_event->event_data; + Mpi2EventDataIrVolume_t *event_data = + (Mpi2EventDataIrVolume_t *) fw_event->event_data; if (ioc->shost_recovery) return; @@ -6160,7 +6163,8 @@ _scsih_sas_ir_physical_disk_event(struct MPT3SAS_ADAPTER *ioc, Mpi2ConfigReply_t mpi_reply; Mpi2SasDevicePage0_t sas_device_pg0; u32 ioc_status; - Mpi2EventDataIrPhysicalDisk_t *event_data = fw_event->event_data; + Mpi2EventDataIrPhysicalDisk_t *event_data = + (Mpi2EventDataIrPhysicalDisk_t *) &fw_event->event_data; u64 sas_address; if (ioc->shost_recovery) @@ -6280,7 +6284,8 @@ static void _scsih_sas_ir_operation_status_event(struct MPT3SAS_ADAPTER *ioc, struct fw_event_work *fw_event) { - Mpi2EventDataIrOperationStatus_t *event_data = fw_event->event_data; + Mpi2EventDataIrOperationStatus_t *event_data = + (Mpi2EventDataIrOperationStatus_t *) &fw_event->event_data; static struct _raid_device *raid_device; unsigned long flags; u16 handle; @@ -7042,7 +7047,9 @@ _mpt3sas_fw_work(struct MPT3SAS_ADAPTER *ioc, struct fw_event_work *fw_event) switch (fw_event->event) { case MPT3SAS_PROCESS_TRIGGER_DIAG: - mpt3sas_process_trigger_data(ioc, fw_event->event_data); + mpt3sas_process_trigger_data(ioc, + (struct SL_WH_TRIGGERS_EVENT_DATA_T *) + &fw_event->event_data); break; case MPT3SAS_REMOVE_UNRESPONDING_DEVICES: while (scsi_host_in_recovery(ioc->shost) || ioc->shost_recovery) @@ -7200,22 +7207,15 @@ mpt3sas_scsih_event_callback(struct MPT3SAS_ADAPTER *ioc, u8 msix_index, return 1; } - fw_event = kzalloc(sizeof(struct fw_event_work), GFP_ATOMIC); - if (!fw_event) { - pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", - ioc->name, __FILE__, __LINE__, __func__); - return 1; - } sz = le16_to_cpu(mpi_reply->EventDataLength) * 4; - fw_event->event_data = kzalloc(sz, GFP_ATOMIC); - if (!fw_event->event_data) { + fw_event = kzalloc(sizeof(*fw_event) + sz, GFP_ATOMIC); + if (!fw_event) { pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", ioc->name, __FILE__, __LINE__, __func__); - kfree(fw_event); return 1; } - memcpy(fw_event->event_data, mpi_reply->EventData, sz); + memcpy(&fw_event->event_data, mpi_reply->EventData, sz); fw_event->ioc = ioc; fw_event->VF_ID = mpi_reply->VF_ID; fw_event->VP_ID = mpi_reply->VP_ID; -- 1.7.10.4 ^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 2/4] mpt3sas: correct scsi_{target,device} hostdata allocation 2014-06-02 14:34 [PATCH 0/4] mpt2/mpt3 static checker fixups Joe Lawrence 2014-06-02 14:34 ` [PATCH 1/4] mpt2sas: correct scsi_{target,device} hostdata allocation Joe Lawrence 2014-06-02 14:37 ` [PATCH 3/4] mpt3sas: fix possible memory leak in mpt3sas_send_trigger_data_event Joe Lawrence @ 2014-06-02 14:38 ` Joe Lawrence 2014-06-02 16:32 ` Christoph Hellwig 2014-06-02 14:38 ` [PATCH 4/4] mpt2sas: annotate ioc->reply_post_host_index as __iomem Joe Lawrence ` (2 subsequent siblings) 5 siblings, 1 reply; 13+ messages in thread From: Joe Lawrence @ 2014-06-02 14:38 UTC (permalink / raw) To: linux-scsi; +Cc: Dan Carpenter, Sreekanth Reddy, Joe Lawrence 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 MPT3SAS_DEVICE (24 bytes) struct scsi_target (760 bytes) > struct MPT3SAS_TARGET (32 bytes) This fixes the following smatch warnings: drivers/scsi/mpt3sas/mpt3sas_scsih.c:1166 _scsih_target_alloc() warn: struct type mismatch 'MPT3SAS_TARGET vs scsi_target' drivers/scsi/mpt3sas/mpt3sas_scsih.c:1280 _scsih_slave_alloc() warn: struct type mismatch 'MPT3SAS_DEVICE vs scsi_device' Signed-off-by: Joe Lawrence <joe.lawrence@stratus.com> Cc: Dan Carpenter <dan.carpenter@oracle.com> Cc: Sreekanth Reddy <Sreekanth.Reddy@lsi.com> --- drivers/scsi/mpt3sas/mpt3sas_scsih.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c b/drivers/scsi/mpt3sas/mpt3sas_scsih.c index a961fe1..e6f0720 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c +++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c @@ -1163,7 +1163,8 @@ _scsih_target_alloc(struct scsi_target *starget) unsigned long flags; struct sas_rphy *rphy; - sas_target_priv_data = kzalloc(sizeof(struct scsi_target), GFP_KERNEL); + sas_target_priv_data = kzalloc(sizeof(*sas_target_priv_data), + GFP_KERNEL); if (!sas_target_priv_data) return -ENOMEM; @@ -1277,7 +1278,8 @@ _scsih_slave_alloc(struct scsi_device *sdev) struct _sas_device *sas_device; unsigned long flags; - sas_device_priv_data = kzalloc(sizeof(struct scsi_device), GFP_KERNEL); + sas_device_priv_data = kzalloc(sizeof(*sas_device_priv_data), + GFP_KERNEL); if (!sas_device_priv_data) return -ENOMEM; -- 1.7.10.4 ^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH 2/4] mpt3sas: correct scsi_{target,device} hostdata allocation 2014-06-02 14:38 ` [PATCH 2/4] mpt3sas: correct scsi_{target,device} hostdata allocation Joe Lawrence @ 2014-06-02 16:32 ` Christoph Hellwig 0 siblings, 0 replies; 13+ messages in thread From: Christoph Hellwig @ 2014-06-02 16:32 UTC (permalink / raw) To: Joe Lawrence; +Cc: linux-scsi, Dan Carpenter, Sreekanth Reddy Looks good, Reviewed-by: Christoph Hellwig <hch@lst.de> ^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 4/4] mpt2sas: annotate ioc->reply_post_host_index as __iomem 2014-06-02 14:34 [PATCH 0/4] mpt2/mpt3 static checker fixups Joe Lawrence ` (2 preceding siblings ...) 2014-06-02 14:38 ` [PATCH 2/4] mpt3sas: correct scsi_{target,device} hostdata allocation Joe Lawrence @ 2014-06-02 14:38 ` Joe Lawrence 2014-06-02 16:32 ` Christoph Hellwig 2014-06-02 16:33 ` [PATCH 0/4] mpt2/mpt3 static checker fixups Christoph Hellwig 2014-06-25 9:43 ` Sreekanth Reddy 5 siblings, 1 reply; 13+ messages in thread From: Joe Lawrence @ 2014-06-02 14:38 UTC (permalink / raw) To: linux-scsi; +Cc: Dan Carpenter, Sreekanth Reddy, Joe Lawrence The MPT2SAS_ADAPTER reply_post_host_index[] holds calculated addresses in memory mapped register space. Add an "__iomem" annotation to silence the following sparse warnings: drivers/scsi/mpt2sas/mpt2sas_base.c:1006:43: warning: incorrect type in argument 2 (different address spaces) expected void volatile [noderef] <asn:2>*addr got unsigned long long [usertype] *<noident> drivers/scsi/mpt2sas/mpt2sas_base.c:4299:22: warning: cast removes address space of expression drivers/scsi/mpt2sas/mpt2sas_base.c:4303:27: warning: cast removes address space of expression Signed-off-by: Joe Lawrence <joe.lawrence@stratus.com> Cc: Dan Carpenter <dan.carpenter@oracle.com> Cc: Sreekanth Reddy <Sreekanth.Reddy@lsi.com> --- drivers/scsi/mpt2sas/mpt2sas_base.c | 9 +++++---- drivers/scsi/mpt2sas/mpt2sas_base.h | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/scsi/mpt2sas/mpt2sas_base.c b/drivers/scsi/mpt2sas/mpt2sas_base.c index bde63f7..a6e477e 100644 --- a/drivers/scsi/mpt2sas/mpt2sas_base.c +++ b/drivers/scsi/mpt2sas/mpt2sas_base.c @@ -4295,12 +4295,13 @@ mpt2sas_base_attach(struct MPT2SAS_ADAPTER *ioc) goto out_free_resources; if (ioc->is_warpdrive) { - ioc->reply_post_host_index[0] = - (resource_size_t *)&ioc->chip->ReplyPostHostIndex; + ioc->reply_post_host_index[0] = (resource_size_t __iomem *) + &ioc->chip->ReplyPostHostIndex; for (i = 1; i < ioc->cpu_msix_table_sz; i++) - ioc->reply_post_host_index[i] = (resource_size_t *) - ((u8 *)&ioc->chip->Doorbell + (0x4000 + ((i - 1) + ioc->reply_post_host_index[i] = + (resource_size_t __iomem *) + ((u8 __iomem *)&ioc->chip->Doorbell + (0x4000 + ((i - 1) * 4))); } diff --git a/drivers/scsi/mpt2sas/mpt2sas_base.h b/drivers/scsi/mpt2sas/mpt2sas_base.h index 1f2ac3a..23d0c85 100644 --- a/drivers/scsi/mpt2sas/mpt2sas_base.h +++ b/drivers/scsi/mpt2sas/mpt2sas_base.h @@ -837,7 +837,7 @@ struct MPT2SAS_ADAPTER { u8 msix_enable; u16 msix_vector_count; u8 *cpu_msix_table; - resource_size_t **reply_post_host_index; + resource_size_t __iomem **reply_post_host_index; u16 cpu_msix_table_sz; u32 ioc_reset_count; MPT2SAS_FLUSH_RUNNING_CMDS schedule_dead_ioc_flush_running_cmds; -- 1.7.10.4 ^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH 4/4] mpt2sas: annotate ioc->reply_post_host_index as __iomem 2014-06-02 14:38 ` [PATCH 4/4] mpt2sas: annotate ioc->reply_post_host_index as __iomem Joe Lawrence @ 2014-06-02 16:32 ` Christoph Hellwig 0 siblings, 0 replies; 13+ messages in thread From: Christoph Hellwig @ 2014-06-02 16:32 UTC (permalink / raw) To: Joe Lawrence; +Cc: linux-scsi, Dan Carpenter, Sreekanth Reddy On Mon, Jun 02, 2014 at 10:38:32AM -0400, Joe Lawrence wrote: > The MPT2SAS_ADAPTER reply_post_host_index[] holds calculated addresses > in memory mapped register space. Add an "__iomem" annotation to silence > the following sparse warnings: Looks good, Reviewed-by: Christoph Hellwig <hch@lst.de> ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 0/4] mpt2/mpt3 static checker fixups 2014-06-02 14:34 [PATCH 0/4] mpt2/mpt3 static checker fixups Joe Lawrence ` (3 preceding siblings ...) 2014-06-02 14:38 ` [PATCH 4/4] mpt2sas: annotate ioc->reply_post_host_index as __iomem Joe Lawrence @ 2014-06-02 16:33 ` Christoph Hellwig 2014-06-02 20:44 ` Joe Lawrence 2014-06-25 9:43 ` Sreekanth Reddy 5 siblings, 1 reply; 13+ messages in thread From: Christoph Hellwig @ 2014-06-02 16:33 UTC (permalink / raw) To: Joe Lawrence; +Cc: linux-scsi, Dan Carpenter, Sreekanth Reddy On Mon, Jun 02, 2014 at 10:34:28AM -0400, Joe Lawrence wrote: > Hello Sreekanth, Dan, > > These are a few minor smatch and sparse static checker fixes for the LSI > mpt2 and mpt3 drivers. The first three fix real potential bugs and the > last cleans up a noisy complaint from sparse. Can you check if any of these also applies to drivers/message/fusion? There is tons of copy & paste between all three drivers unfortunately. ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 0/4] mpt2/mpt3 static checker fixups 2014-06-02 16:33 ` [PATCH 0/4] mpt2/mpt3 static checker fixups Christoph Hellwig @ 2014-06-02 20:44 ` Joe Lawrence 0 siblings, 0 replies; 13+ messages in thread From: Joe Lawrence @ 2014-06-02 20:44 UTC (permalink / raw) To: Christoph Hellwig; +Cc: linux-scsi, Dan Carpenter, Sreekanth Reddy On Mon, 2 Jun 2014 09:33:07 -0700 Christoph Hellwig <hch@infradead.org> wrote: > On Mon, Jun 02, 2014 at 10:34:28AM -0400, Joe Lawrence wrote: > > Hello Sreekanth, Dan, > > > > These are a few minor smatch and sparse static checker fixes for the LSI > > mpt2 and mpt3 drivers. The first three fix real potential bugs and the > > last cleans up a noisy complaint from sparse. > > Can you check if any of these also applies to drivers/message/fusion? > There is tons of copy & paste between all three drivers unfortunately. The fixes in this patchset don't apply to drivers/message/fusion, however there are a half-dozen or so warnings that I could take a look at if the driver is still maintained. -- Joe ^ permalink raw reply [flat|nested] 13+ messages in thread
* RE: [PATCH 0/4] mpt2/mpt3 static checker fixups 2014-06-02 14:34 [PATCH 0/4] mpt2/mpt3 static checker fixups Joe Lawrence ` (4 preceding siblings ...) 2014-06-02 16:33 ` [PATCH 0/4] mpt2/mpt3 static checker fixups Christoph Hellwig @ 2014-06-25 9:43 ` Sreekanth Reddy 5 siblings, 0 replies; 13+ messages in thread From: Sreekanth Reddy @ 2014-06-25 9:43 UTC (permalink / raw) To: Joe Lawrence, linux-scsi, James Bottomley Cc: Dan Carpenter, Sreekanth Reddy, Christoph Hellwig, Martin K. Petersen James, This Patch set seems to be fine. Please consider this patch set as Acked-by: Sreekanth Reddy <Sreekanth.Reddy@avagotech.com> Regards, Sreekanth >-----Original Message----- >From: linux-scsi-owner@vger.kernel.org [mailto:linux-scsi- >owner@vger.kernel.org] On Behalf Of Joe Lawrence >Sent: Monday, June 02, 2014 8:04 PM >To: linux-scsi@vger.kernel.org >Cc: Dan Carpenter; Sreekanth Reddy; Joe Lawrence >Subject: [PATCH 0/4] mpt2/mpt3 static checker fixups > >Hello Sreekanth, Dan, > >These are a few minor smatch and sparse static checker fixes for the LSI >mpt2 and mpt3 drivers. The first three fix real potential bugs and the last >cleans up a noisy complaint from sparse. > >Joe Lawrence (4): > mpt2sas: correct scsi_{target,device} hostdata allocation > mpt3sas: correct scsi_{target,device} hostdata allocation > mpt3sas: fix possible memory leak in mpt3sas_send_trigger_data_event > mpt2sas: annotate ioc->reply_post_host_index as __iomem > > drivers/scsi/mpt2sas/mpt2sas_base.c | 9 +++++---- > drivers/scsi/mpt2sas/mpt2sas_base.h | 2 +- > drivers/scsi/mpt2sas/mpt2sas_scsih.c | 6 ++++-- > drivers/scsi/mpt3sas/mpt3sas_scsih.c | 10 +++++++--- > 4 files changed, 17 insertions(+), 10 deletions(-) > >-- >1.7.10.4 > >-- >To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body >of a message to majordomo@vger.kernel.org More majordomo info at >http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2014-06-25 9:44 UTC | newest] Thread overview: 13+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2014-06-02 14:34 [PATCH 0/4] mpt2/mpt3 static checker fixups Joe Lawrence 2014-06-02 14:34 ` [PATCH 1/4] mpt2sas: correct scsi_{target,device} hostdata allocation Joe Lawrence 2014-06-02 16:30 ` Christoph Hellwig 2014-06-02 14:37 ` [PATCH 3/4] mpt3sas: fix possible memory leak in mpt3sas_send_trigger_data_event Joe Lawrence 2014-06-02 16:31 ` Christoph Hellwig 2014-06-02 20:41 ` Christoph Hellwig <hch@infradead.org> wrote: Joe Lawrence 2014-06-02 14:38 ` [PATCH 2/4] mpt3sas: correct scsi_{target,device} hostdata allocation Joe Lawrence 2014-06-02 16:32 ` Christoph Hellwig 2014-06-02 14:38 ` [PATCH 4/4] mpt2sas: annotate ioc->reply_post_host_index as __iomem Joe Lawrence 2014-06-02 16:32 ` Christoph Hellwig 2014-06-02 16:33 ` [PATCH 0/4] mpt2/mpt3 static checker fixups Christoph Hellwig 2014-06-02 20:44 ` Joe Lawrence 2014-06-25 9:43 ` Sreekanth Reddy
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).