[lkml]   [2012]   [Jul]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    Patch in this message
    Subject[PATCH 7/7] drivers/s390/scsi/zfcp_cfdc.c: remove invalid reference to list iterator variable
    From: Julia Lawall <>

    If list_for_each_entry, etc complete a traversal of the list, the iterator
    variable ends up pointing to an address at an offset from the list head,
    and not a meaningful structure. Thus this value should not be used after
    the end of the iterator. Replace port->adapter->scsi_host by

    This problem was found using Coccinelle (

    Signed-off-by: Julia Lawall <>

    This is not tested, an I am not sure that this is the right change.
    Indeed, I'm not at all sure how the original code could have worked, since
    port->adapter->scsi_host should be a completely random value.

    drivers/s390/scsi/zfcp_cfdc.c | 2 +-
    1 file changed, 1 insertion(+), 1 deletion(-)

    diff --git a/drivers/s390/scsi/zfcp_cfdc.c b/drivers/s390/scsi/zfcp_cfdc.c
    index fab2c25..8ed63aa 100644
    --- a/drivers/s390/scsi/zfcp_cfdc.c
    +++ b/drivers/s390/scsi/zfcp_cfdc.c
    @@ -293,7 +293,7 @@ void zfcp_cfdc_adapter_access_changed(struct zfcp_adapter *adapter)
    read_unlock_irqrestore(&adapter->port_list_lock, flags);

    - shost_for_each_device(sdev, port->adapter->scsi_host) {
    + shost_for_each_device(sdev, adapter->scsi_host) {
    zfcp_sdev = sdev_to_zfcp(sdev);
    status = atomic_read(&zfcp_sdev->status);

     \ /
      Last update: 2012-07-08 14:01    [W:0.021 / U:47.364 seconds]
    ©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site