Project

General

Profile

Bug #11862

cleanup smatch/cstyle/wscheck issues in usr/src/lib/sun_sas/

Added by Rob Johnston 4 months ago. Updated 4 months ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
-
Start date:
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:

Description

usr/src/lib/sun_sas/ contains code that implements the lower-level (vendor-specific) layer of the SM-HBA API (usr/src/lib/hbaapi).

Smatch is currently disabled for usr/src/lib/sun_sas/ due to a number of pre-existing smatch issues. As we (Joyent) may be SM-HBA for the SAS Topology project, it seems like it would be a good idea to clean up these warnings and then enable smatch checks going forward.

Below are smatch warnings that need to be addressed:

 ../common/Sun_sasGetNumberOfAdapters.c38 Sun_sasGetNumberOfAdapters() warn inconsistent indenting
 ../common/Sun_sasGetAdapterName.c49 Sun_sasGetAdapterName() warn this array is probably non-NULL. 'hba_ptr->handle_name'
 ../common/Sun_sasGetDiscoveredPortAttributes.c75 Sun_sasGetDiscoveredPortAttributes() warn this array is probably non-NULL. 'hba_ptr->device_path'
 ../common/Sun_sasGetAdapterPortAttributes.c70 Sun_sasGetAdapterPortAttributes() warn this array is probably non-NULL. 'hba_ptr->device_path'
 ../common/Sun_sasFreeLibrary.c93 FreeHBA() warn inconsistent indenting
 ../common/Sun_sasGetPortAttributesByWWN.c74 Sun_sasGetPortAttributesByWWN() warn this array is probably non-NULL. 'hba_ptr->device_path'
 ../common/Sun_sasGetPortType.c62 Sun_sasGetPortType() warn this array is probably non-NULL. 'hba_ptr->device_path'
 ../common/Sun_sasRefreshAdapterConfiguration.c61 find_matching_hba() warn inconsistent indenting
 ../common/sun_sas.c347 getFirstAdapterPortWWN() warn this array is probably non-NULL. 'hba_ptr->device_path'
 ../common/Sun_sasGetPhyStatistics.c220 Sun_sasGetPhyStatistics() warn inconsistent indenting
 ../common/Sun_sasScsiInquiry.c134 Sun_sasScsiInquiry() warn this array is probably non-NULL. 'hba_ptr->device_path'
 ../common/Sun_sasSendSMPPassThru.c136 Sun_sasSendSMPPassThru() warn this array is probably non-NULL. 'hba_ptr->device_path'
 ../common/devtree_device_disco.c494 get_attached_devices_info() warn inconsistent indenting
 ../common/devtree_device_disco.c910 get_attached_paths_info() warn inconsistent indenting

History

#1

Updated by Rob Johnston 4 months ago

  • Subject changed from cleanup smatch issues in usr/src/lib/sun_sas/ to cleanup smatch/cstyle issues in usr/src/lib/sun_sas/
#2

Updated by Rob Johnston 4 months ago

There's also a boatload of cstyle and wscheck issue. I'll be taking care of these at the same time.

#3

Updated by Rob Johnston 4 months ago

  • Subject changed from cleanup smatch/cstyle issues in usr/src/lib/sun_sas/ to cleanup smatch/cstyle/wscheck issues in usr/src/lib/sun_sas/
#4

Updated by Rob Johnston 4 months ago

Testing

I exercised the sun_sas plugin for libSMHBAAPI.so.1 via the sasinfo CLI and verified that the various subcommands returned accurate information and the program didn't crash. I also verified that the build was clean and that git pbchk was clean.

# sasinfo hba
HBA Name: SUNW-mpt_sas-0

# sasinfo hba -v
HBA Name: SUNW-mpt_sas-0
    Manufacturer: LSISAS3008
    Model:  LSI3008-IT
    Firmware Version: 15.0.3.0
    FCode/BIOS Version: not available
    Serial Number: LSISAS3008ALLLSI3008-IT
    Driver Name: mpt_sas
    Driver Version: MPTSAS HBA Driver 00.00.00.24
    Number of HBA Ports: 1

# sasinfo hba-port
HBA Name: SUNW-mpt_sas-0
  HBA Port Name: /dev/cfg/c2
[root@magma ~]# sasinfo hba-port -v
HBA Name: SUNW-mpt_sas-0
  HBA Port Name: /dev/cfg/c2
    Type: SAS Device
    State: online
    Local SAS Address: 5003048023567a00
    Attached SAS Address: 500304801861347f
    Number of Phys: 8

# sasinfo expander
HBA Name: SUNW-mpt_sas-0
  HBA Port Name: /dev/cfg/c2
    Expander SAS Address(Tier 1): 500304801861347f
        Expander SAS Address(Tier 2): 500304801e84c7ff

# sasinfo expander -v
HBA Name: SUNW-mpt_sas-0
  HBA Port Name: /dev/cfg/c2
    Expander SAS Address(Tier 1): 500304801861347f
      OS Device Name: /dev/smp/expd0
      State:  online
        Expander SAS Address(Tier 2): 500304801e84c7ff
          OS Device Name: /dev/smp/expd1

# sasinfo lu
OS Device Name: /dev/rdsk/c2t5000CCA0496FCA6Dd0s2
OS Device Name: /dev/es/ses0
OS Device Name: /dev/es/ses1
OS Device Name: /dev/rdsk/c0t5000C500ADC881D7d0s2
OS Device Name: /dev/rdsk/c0t5000C500ADC88587d0s2
OS Device Name: /dev/rdsk/c0t5000C500ADC08F4Bd0s2
OS Device Name: /dev/rdsk/c0t5000C500ADC8BD7Fd0s2
OS Device Name: /dev/rdsk/c0t5000C500ADC7A3DBd0s2
OS Device Name: /dev/rdsk/c0t5000C500ADC0E24Bd0s2
OS Device Name: /dev/rdsk/c0t5000C500ADC78617d0s2
OS Device Name: /dev/rdsk/c0t5000C500ADCC757Fd0s2
OS Device Name: /dev/rdsk/c0t5000C500ADCEED1Fd0s2
OS Device Name: /dev/rdsk/c0t5000C500ADC79E67d0s2
OS Device Name: /dev/rdsk/c0t5000C500ADCE5DBBd0s2
OS Device Name: /dev/rdsk/c0t5000C500ADC7DA4Bd0s2
OS Device Name: /dev/rdsk/c0t5000C500ADCE5677d0s2
OS Device Name: /dev/rdsk/c0t5000C500ADC8F3BFd0s2
OS Device Name: /dev/rdsk/c0t5000C500ADC70B63d0s2
OS Device Name: /dev/rdsk/c0t5000C500ADC04683d0s2
OS Device Name: /dev/rdsk/c0t5000C500ADC8C8D3d0s2
OS Device Name: /dev/rdsk/c0t5000C500ADC7D7ABd0s2
OS Device Name: /dev/rdsk/c0t5000C500ADCC907Fd0s2
OS Device Name: /dev/rdsk/c0t5000C500ADC0B5BFd0s2

# sasinfo lu -v
OS Device Name: /dev/rdsk/c2t5000CCA0496FCA6Dd0s2
    HBA Port Name: /dev/cfg/c2
        Target Port SAS Address: 5000cca0496fca6d
            LUN: 0
    Vendor: HGST    
    Product: HUSMH8010BSS204 
    Device Type: Disk Device
OS Device Name: /dev/es/ses0
    HBA Port Name: /dev/cfg/c2
        Target Port SAS Address: 500304801861347d
            LUN: 0
    Vendor: SMC     
    Product: SC846P          
    Device Type: Enclosure Services Device
OS Device Name: /dev/es/ses1
    HBA Port Name: /dev/cfg/c2
        Target Port SAS Address: 500304801e84c7fd
            LUN: 0
    Vendor: LSI     
    Product: SAS3x28         
    Device Type: Enclosure Services Device
OS Device Name: /dev/rdsk/c0t5000C500ADC881D7d0s2
    HBA Port Name: /dev/cfg/c2
        Target Port SAS Address: 5000c500adc881d5
            LUN: 0
    Vendor: SEAGATE 
    Product: ST16000NM002G   
    Device Type: Disk Device
OS Device Name: /dev/rdsk/c0t5000C500ADC88587d0s2
    HBA Port Name: /dev/cfg/c2
        Target Port SAS Address: 5000c500adc88585
            LUN: 0
    Vendor: SEAGATE 
    Product: ST16000NM002G   
    Device Type: Disk Device
OS Device Name: /dev/rdsk/c0t5000C500ADC08F4Bd0s2
    HBA Port Name: /dev/cfg/c2
        Target Port SAS Address: 5000c500adc08f49
            LUN: 0
    Vendor: SEAGATE 
    Product: ST16000NM002G   
    Device Type: Disk Device
OS Device Name: /dev/rdsk/c0t5000C500ADC8BD7Fd0s2
    HBA Port Name: /dev/cfg/c2
        Target Port SAS Address: 5000c500adc8bd7d
            LUN: 0
    Vendor: SEAGATE 
    Product: ST16000NM002G   
    Device Type: Disk Device
OS Device Name: /dev/rdsk/c0t5000C500ADC7A3DBd0s2
    HBA Port Name: /dev/cfg/c2
        Target Port SAS Address: 5000c500adc7a3d9
            LUN: 0
    Vendor: SEAGATE 
    Product: ST16000NM002G   
    Device Type: Disk Device
OS Device Name: /dev/rdsk/c0t5000C500ADC0E24Bd0s2
    HBA Port Name: /dev/cfg/c2
        Target Port SAS Address: 5000c500adc0e249
            LUN: 0
    Vendor: SEAGATE 
    Product: ST16000NM002G   
    Device Type: Disk Device
OS Device Name: /dev/rdsk/c0t5000C500ADC78617d0s2
    HBA Port Name: /dev/cfg/c2
        Target Port SAS Address: 5000c500adc78615
            LUN: 0
    Vendor: SEAGATE 
    Product: ST16000NM002G   
    Device Type: Disk Device
OS Device Name: /dev/rdsk/c0t5000C500ADCC757Fd0s2
    HBA Port Name: /dev/cfg/c2
        Target Port SAS Address: 5000c500adcc757d
            LUN: 0
    Vendor: SEAGATE 
    Product: ST16000NM002G   
    Device Type: Disk Device
OS Device Name: /dev/rdsk/c0t5000C500ADCEED1Fd0s2
    HBA Port Name: /dev/cfg/c2
        Target Port SAS Address: 5000c500adceed1d
            LUN: 0
    Vendor: SEAGATE 
    Product: ST16000NM002G   
    Device Type: Disk Device
OS Device Name: /dev/rdsk/c0t5000C500ADC79E67d0s2
    HBA Port Name: /dev/cfg/c2
        Target Port SAS Address: 5000c500adc79e65
            LUN: 0
    Vendor: SEAGATE 
    Product: ST16000NM002G   
    Device Type: Disk Device
OS Device Name: /dev/rdsk/c0t5000C500ADCE5DBBd0s2
    HBA Port Name: /dev/cfg/c2
        Target Port SAS Address: 5000c500adce5db9
            LUN: 0
    Vendor: SEAGATE 
    Product: ST16000NM002G   
    Device Type: Disk Device
OS Device Name: /dev/rdsk/c0t5000C500ADC7DA4Bd0s2
    HBA Port Name: /dev/cfg/c2
        Target Port SAS Address: 5000c500adc7da49
            LUN: 0
    Vendor: SEAGATE 
    Product: ST16000NM002G   
    Device Type: Disk Device
OS Device Name: /dev/rdsk/c0t5000C500ADCE5677d0s2
    HBA Port Name: /dev/cfg/c2
        Target Port SAS Address: 5000c500adce5675
            LUN: 0
    Vendor: SEAGATE 
    Product: ST16000NM002G   
    Device Type: Disk Device
OS Device Name: /dev/rdsk/c0t5000C500ADC8F3BFd0s2
    HBA Port Name: /dev/cfg/c2
        Target Port SAS Address: 5000c500adc8f3bd
            LUN: 0
    Vendor: SEAGATE 
    Product: ST16000NM002G   
    Device Type: Disk Device
OS Device Name: /dev/rdsk/c0t5000C500ADC70B63d0s2
    HBA Port Name: /dev/cfg/c2
        Target Port SAS Address: 5000c500adc70b61
            LUN: 0
    Vendor: SEAGATE 
    Product: ST16000NM002G   
    Device Type: Disk Device
OS Device Name: /dev/rdsk/c0t5000C500ADC04683d0s2
    HBA Port Name: /dev/cfg/c2
        Target Port SAS Address: 5000c500adc04681
            LUN: 0
    Vendor: SEAGATE 
    Product: ST16000NM002G   
    Device Type: Disk Device
OS Device Name: /dev/rdsk/c0t5000C500ADC8C8D3d0s2
    HBA Port Name: /dev/cfg/c2
        Target Port SAS Address: 5000c500adc8c8d1
            LUN: 0
    Vendor: SEAGATE 
    Product: ST16000NM002G   
    Device Type: Disk Device
OS Device Name: /dev/rdsk/c0t5000C500ADC7D7ABd0s2
    HBA Port Name: /dev/cfg/c2
        Target Port SAS Address: 5000c500adc7d7a9
            LUN: 0
    Vendor: SEAGATE 
    Product: ST16000NM002G   
    Device Type: Disk Device
OS Device Name: /dev/rdsk/c0t5000C500ADCC907Fd0s2
    HBA Port Name: /dev/cfg/c2
        Target Port SAS Address: 5000c500adcc907d
            LUN: 0
    Vendor: SEAGATE 
    Product: ST16000NM002G   
    Device Type: Disk Device
OS Device Name: /dev/rdsk/c0t5000C500ADC0B5BFd0s2
    HBA Port Name: /dev/cfg/c2
        Target Port SAS Address: 5000c500adc0b5bd
            LUN: 0
    Vendor: SEAGATE 
    Product: ST16000NM002G   
    Device Type: Disk Device

# sasinfo target-port
Target Port SAS Address: 5000c500adc0b5bd
Target Port SAS Address: 5000c500adcc907d
Target Port SAS Address: 5000c500adc7d7a9
Target Port SAS Address: 5000c500adc8c8d1
Target Port SAS Address: 5000c500adc04681
Target Port SAS Address: 5000c500adc70b61
Target Port SAS Address: 5000c500adc8f3bd
Target Port SAS Address: 5000c500adce5675
Target Port SAS Address: 5000c500adc7da49
Target Port SAS Address: 5000c500adce5db9
Target Port SAS Address: 5000c500adc79e65
Target Port SAS Address: 5000c500adceed1d
Target Port SAS Address: 5000c500adcc757d
Target Port SAS Address: 5000c500adc78615
Target Port SAS Address: 5000c500adc0e249
Target Port SAS Address: 5000c500adc7a3d9
Target Port SAS Address: 5000c500adc8bd7d
Target Port SAS Address: 5000c500adc08f49
Target Port SAS Address: 5000c500adc88585
Target Port SAS Address: 5000c500adc881d5
Target Port SAS Address: 500304801e84c7fd
Target Port SAS Address: 500304801861347d
Target Port SAS Address: 5000cca0496fca6d

# sasinfo target-port -v
Target Port SAS Address: 5000c500adc0b5bd
    Type: SAS Device
    HBA Port Name: /dev/cfg/c2
        Expander Device SAS Address: 500304801e84c7ff
Target Port SAS Address: 5000c500adcc907d
    Type: SAS Device
    HBA Port Name: /dev/cfg/c2
        Expander Device SAS Address: 500304801e84c7ff
Target Port SAS Address: 5000c500adc7d7a9
    Type: SAS Device
    HBA Port Name: /dev/cfg/c2
        Expander Device SAS Address: 500304801e84c7ff
Target Port SAS Address: 5000c500adc8c8d1
    Type: SAS Device
    HBA Port Name: /dev/cfg/c2
        Expander Device SAS Address: 500304801e84c7ff
Target Port SAS Address: 5000c500adc04681
    Type: SAS Device
    HBA Port Name: /dev/cfg/c2
        Expander Device SAS Address: 500304801e84c7ff
Target Port SAS Address: 5000c500adc70b61
    Type: SAS Device
    HBA Port Name: /dev/cfg/c2
        Expander Device SAS Address: 500304801861347f
Target Port SAS Address: 5000c500adc8f3bd
    Type: SAS Device
    HBA Port Name: /dev/cfg/c2
        Expander Device SAS Address: 500304801861347f
Target Port SAS Address: 5000c500adce5675
    Type: SAS Device
    HBA Port Name: /dev/cfg/c2
        Expander Device SAS Address: 500304801861347f
Target Port SAS Address: 5000c500adc7da49
    Type: SAS Device
    HBA Port Name: /dev/cfg/c2
        Expander Device SAS Address: 500304801861347f
Target Port SAS Address: 5000c500adce5db9
    Type: SAS Device
    HBA Port Name: /dev/cfg/c2
        Expander Device SAS Address: 500304801861347f
Target Port SAS Address: 5000c500adc79e65
    Type: SAS Device
    HBA Port Name: /dev/cfg/c2
        Expander Device SAS Address: 500304801861347f
Target Port SAS Address: 5000c500adceed1d
    Type: SAS Device
    HBA Port Name: /dev/cfg/c2
        Expander Device SAS Address: 500304801861347f
Target Port SAS Address: 5000c500adcc757d
    Type: SAS Device
    HBA Port Name: /dev/cfg/c2
        Expander Device SAS Address: 500304801861347f
Target Port SAS Address: 5000c500adc78615
    Type: SAS Device
    HBA Port Name: /dev/cfg/c2
        Expander Device SAS Address: 500304801861347f
Target Port SAS Address: 5000c500adc0e249
    Type: SAS Device
    HBA Port Name: /dev/cfg/c2
        Expander Device SAS Address: 500304801861347f
Target Port SAS Address: 5000c500adc7a3d9
    Type: SAS Device
    HBA Port Name: /dev/cfg/c2
        Expander Device SAS Address: 500304801861347f
Target Port SAS Address: 5000c500adc8bd7d
    Type: SAS Device
    HBA Port Name: /dev/cfg/c2
        Expander Device SAS Address: 500304801861347f
Target Port SAS Address: 5000c500adc08f49
    Type: SAS Device
    HBA Port Name: /dev/cfg/c2
        Expander Device SAS Address: 500304801861347f
Target Port SAS Address: 5000c500adc88585
    Type: SAS Device
    HBA Port Name: /dev/cfg/c2
        Expander Device SAS Address: 500304801861347f
Target Port SAS Address: 5000c500adc881d5
    Type: SAS Device
    HBA Port Name: /dev/cfg/c2
        Expander Device SAS Address: 500304801861347f
Target Port SAS Address: 500304801e84c7fd
    Type: SAS Device
    HBA Port Name: /dev/cfg/c2
        Expander Device SAS Address: 500304801e84c7ff
Target Port SAS Address: 500304801861347d
    Type: SAS Device
    HBA Port Name: /dev/cfg/c2
        Expander Device SAS Address: 500304801861347f
Target Port SAS Address: 5000cca0496fca6d
    Type: SAS Device
    HBA Port Name: /dev/cfg/c2
        Expander Device SAS Address: 500304801861347f

#5

Updated by Electric Monk 4 months ago

  • Status changed from New to Closed
  • % Done changed from 0 to 100

git commit 00f453f4ebc211cb928f19a54d3f4edd61f43279

commit  00f453f4ebc211cb928f19a54d3f4edd61f43279
Author: Rob Johnston <rob.johnston@joyent.com>
Date:   2019-10-29T23:39:28.000Z

    11862 cleanup smatch/cstyle/wscheck issues in usr/src/lib/sun_sas/
    Reviewed by: Andy Fiddaman <omnios@citrus-it.co.uk>
    Reviewed by: Andy Stormont <astormont@racktopsystems.com>
    Reviewed by: Igor Kozhukhov <igor@dilos.org>
    Reviewed by: Kody Kantor <kody.kantor@joyent.com>
    Approved by: Robert Mustacchi <rm@fingolfin.org>

Also available in: Atom PDF