CC: kbuild-...@lists.01.org CC: linux-ker...@vger.kernel.org TO: Gilbert Wu <gilbert...@microsemi.com> CC: "Martin K. Petersen" <martin.peter...@oracle.com> CC: Scott Benesh <scott.ben...@microsemi.com> CC: Kevin Barnett <kevin.barn...@microsemi.com> CC: Don Brace <don.br...@microsemi.com>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: 1b5044021070efa3259f3e9548dc35d1eb6aa844 commit: 5e6a9760f7da4dd86cca43ac6423695d6cb0dff4 scsi: smartpqi: add module param for exposure order date: 10 months ago :::::: branch date: 12 hours ago :::::: commit date: 10 months ago config: arm-randconfig-m031-20200618 (attached as .config) compiler: arm-linux-gnueabi-gcc (GCC) 9.3.0 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <l...@intel.com> Reported-by: Dan Carpenter <dan.carpen...@oracle.com> New smatch warnings: drivers/scsi/smartpqi/smartpqi_init.c:2070 pqi_update_scsi_devices() error: we previously assumed 'physdev_list' could be null (see line 2006) Old smatch warnings: drivers/scsi/smartpqi/smartpqi_init.c:2077 pqi_update_scsi_devices() error: we previously assumed 'logdev_list' could be null (see line 2013) drivers/scsi/smartpqi/smartpqi_init.c:2134 pqi_update_scsi_devices() warn: inconsistent indenting drivers/scsi/smartpqi/smartpqi_init.c:6995 pqi_ctrl_init() warn: impossible condition '(ctrl_info->max_outstanding_requests > (~0)) => (0-u32max > u32max)' # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=5e6a9760f7da4dd86cca43ac6423695d6cb0dff4 git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git git remote update linus git checkout 5e6a9760f7da4dd86cca43ac6423695d6cb0dff4 vim +/physdev_list +2070 drivers/scsi/smartpqi/smartpqi_init.c cd128244162c8a Dave Carroll 2018-12-07 1977 6c223761eb5482 Kevin Barnett 2016-06-27 1978 static int pqi_update_scsi_devices(struct pqi_ctrl_info *ctrl_info) 6c223761eb5482 Kevin Barnett 2016-06-27 1979 { 6c223761eb5482 Kevin Barnett 2016-06-27 1980 int i; 6c223761eb5482 Kevin Barnett 2016-06-27 1981 int rc; 8a994a04fc3a8e Kevin Barnett 2017-05-03 1982 LIST_HEAD(new_device_list_head); 6c223761eb5482 Kevin Barnett 2016-06-27 1983 struct report_phys_lun_extended *physdev_list = NULL; 6c223761eb5482 Kevin Barnett 2016-06-27 1984 struct report_log_lun_extended *logdev_list = NULL; 6c223761eb5482 Kevin Barnett 2016-06-27 1985 struct report_phys_lun_extended_entry *phys_lun_ext_entry; 6c223761eb5482 Kevin Barnett 2016-06-27 1986 struct report_log_lun_extended_entry *log_lun_ext_entry; 6c223761eb5482 Kevin Barnett 2016-06-27 1987 struct bmic_identify_physical_device *id_phys = NULL; 6c223761eb5482 Kevin Barnett 2016-06-27 1988 u32 num_physicals; 6c223761eb5482 Kevin Barnett 2016-06-27 1989 u32 num_logicals; 6c223761eb5482 Kevin Barnett 2016-06-27 1990 struct pqi_scsi_dev **new_device_list = NULL; 6c223761eb5482 Kevin Barnett 2016-06-27 1991 struct pqi_scsi_dev *device; 6c223761eb5482 Kevin Barnett 2016-06-27 1992 struct pqi_scsi_dev *next; 6c223761eb5482 Kevin Barnett 2016-06-27 1993 unsigned int num_new_devices; 6c223761eb5482 Kevin Barnett 2016-06-27 1994 unsigned int num_valid_devices; 6c223761eb5482 Kevin Barnett 2016-06-27 1995 bool is_physical_device; 6c223761eb5482 Kevin Barnett 2016-06-27 1996 u8 *scsi3addr; 5e6a9760f7da4d Gilbert Wu 2019-08-22 1997 unsigned int physical_index; 5e6a9760f7da4d Gilbert Wu 2019-08-22 1998 unsigned int logical_index; 6c223761eb5482 Kevin Barnett 2016-06-27 1999 static char *out_of_memory_msg = 6de783f6662917 Kevin Barnett 2017-05-03 2000 "failed to allocate memory, device discovery stopped"; 6c223761eb5482 Kevin Barnett 2016-06-27 2001 6c223761eb5482 Kevin Barnett 2016-06-27 2002 rc = pqi_get_device_lists(ctrl_info, &physdev_list, &logdev_list); 6c223761eb5482 Kevin Barnett 2016-06-27 2003 if (rc) 6c223761eb5482 Kevin Barnett 2016-06-27 2004 goto out; 6c223761eb5482 Kevin Barnett 2016-06-27 2005 6c223761eb5482 Kevin Barnett 2016-06-27 @2006 if (physdev_list) 6c223761eb5482 Kevin Barnett 2016-06-27 2007 num_physicals = 6c223761eb5482 Kevin Barnett 2016-06-27 2008 get_unaligned_be32(&physdev_list->header.list_length) 6c223761eb5482 Kevin Barnett 2016-06-27 2009 / sizeof(physdev_list->lun_entries[0]); 6c223761eb5482 Kevin Barnett 2016-06-27 2010 else 6c223761eb5482 Kevin Barnett 2016-06-27 2011 num_physicals = 0; 6c223761eb5482 Kevin Barnett 2016-06-27 2012 6c223761eb5482 Kevin Barnett 2016-06-27 2013 if (logdev_list) 6c223761eb5482 Kevin Barnett 2016-06-27 2014 num_logicals = 6c223761eb5482 Kevin Barnett 2016-06-27 2015 get_unaligned_be32(&logdev_list->header.list_length) 6c223761eb5482 Kevin Barnett 2016-06-27 2016 / sizeof(logdev_list->lun_entries[0]); 6c223761eb5482 Kevin Barnett 2016-06-27 2017 else 6c223761eb5482 Kevin Barnett 2016-06-27 2018 num_logicals = 0; 6c223761eb5482 Kevin Barnett 2016-06-27 2019 6c223761eb5482 Kevin Barnett 2016-06-27 2020 if (num_physicals) { 6c223761eb5482 Kevin Barnett 2016-06-27 2021 /* 6c223761eb5482 Kevin Barnett 2016-06-27 2022 * We need this buffer for calls to pqi_get_physical_disk_info() 6c223761eb5482 Kevin Barnett 2016-06-27 2023 * below. We allocate it here instead of inside 6c223761eb5482 Kevin Barnett 2016-06-27 2024 * pqi_get_physical_disk_info() because it's a fairly large 6c223761eb5482 Kevin Barnett 2016-06-27 2025 * buffer. 6c223761eb5482 Kevin Barnett 2016-06-27 2026 */ 6c223761eb5482 Kevin Barnett 2016-06-27 2027 id_phys = kmalloc(sizeof(*id_phys), GFP_KERNEL); 6c223761eb5482 Kevin Barnett 2016-06-27 2028 if (!id_phys) { 6c223761eb5482 Kevin Barnett 2016-06-27 2029 dev_warn(&ctrl_info->pci_dev->dev, "%s\n", 6c223761eb5482 Kevin Barnett 2016-06-27 2030 out_of_memory_msg); 6c223761eb5482 Kevin Barnett 2016-06-27 2031 rc = -ENOMEM; 6c223761eb5482 Kevin Barnett 2016-06-27 2032 goto out; 6c223761eb5482 Kevin Barnett 2016-06-27 2033 } 6c223761eb5482 Kevin Barnett 2016-06-27 2034 } 6c223761eb5482 Kevin Barnett 2016-06-27 2035 6c223761eb5482 Kevin Barnett 2016-06-27 2036 num_new_devices = num_physicals + num_logicals; 6c223761eb5482 Kevin Barnett 2016-06-27 2037 6da2ec56059c3c Kees Cook 2018-06-12 2038 new_device_list = kmalloc_array(num_new_devices, 6da2ec56059c3c Kees Cook 2018-06-12 2039 sizeof(*new_device_list), 6da2ec56059c3c Kees Cook 2018-06-12 2040 GFP_KERNEL); 6c223761eb5482 Kevin Barnett 2016-06-27 2041 if (!new_device_list) { 6c223761eb5482 Kevin Barnett 2016-06-27 2042 dev_warn(&ctrl_info->pci_dev->dev, "%s\n", out_of_memory_msg); 6c223761eb5482 Kevin Barnett 2016-06-27 2043 rc = -ENOMEM; 6c223761eb5482 Kevin Barnett 2016-06-27 2044 goto out; 6c223761eb5482 Kevin Barnett 2016-06-27 2045 } 6c223761eb5482 Kevin Barnett 2016-06-27 2046 6c223761eb5482 Kevin Barnett 2016-06-27 2047 for (i = 0; i < num_new_devices; i++) { 6c223761eb5482 Kevin Barnett 2016-06-27 2048 device = kzalloc(sizeof(*device), GFP_KERNEL); 6c223761eb5482 Kevin Barnett 2016-06-27 2049 if (!device) { 6c223761eb5482 Kevin Barnett 2016-06-27 2050 dev_warn(&ctrl_info->pci_dev->dev, "%s\n", 6c223761eb5482 Kevin Barnett 2016-06-27 2051 out_of_memory_msg); 6c223761eb5482 Kevin Barnett 2016-06-27 2052 rc = -ENOMEM; 6c223761eb5482 Kevin Barnett 2016-06-27 2053 goto out; 6c223761eb5482 Kevin Barnett 2016-06-27 2054 } 6c223761eb5482 Kevin Barnett 2016-06-27 2055 list_add_tail(&device->new_device_list_entry, 6c223761eb5482 Kevin Barnett 2016-06-27 2056 &new_device_list_head); 6c223761eb5482 Kevin Barnett 2016-06-27 2057 } 6c223761eb5482 Kevin Barnett 2016-06-27 2058 6c223761eb5482 Kevin Barnett 2016-06-27 2059 device = NULL; 6c223761eb5482 Kevin Barnett 2016-06-27 2060 num_valid_devices = 0; 5e6a9760f7da4d Gilbert Wu 2019-08-22 2061 physical_index = 0; 5e6a9760f7da4d Gilbert Wu 2019-08-22 2062 logical_index = 0; 6c223761eb5482 Kevin Barnett 2016-06-27 2063 6c223761eb5482 Kevin Barnett 2016-06-27 2064 for (i = 0; i < num_new_devices; i++) { 6c223761eb5482 Kevin Barnett 2016-06-27 2065 5e6a9760f7da4d Gilbert Wu 2019-08-22 2066 if ((!pqi_expose_ld_first && i < num_physicals) || 5e6a9760f7da4d Gilbert Wu 2019-08-22 2067 (pqi_expose_ld_first && i >= num_logicals)) { 6c223761eb5482 Kevin Barnett 2016-06-27 2068 is_physical_device = true; 5e6a9760f7da4d Gilbert Wu 2019-08-22 2069 phys_lun_ext_entry = 5e6a9760f7da4d Gilbert Wu 2019-08-22 @2070 &physdev_list->lun_entries[physical_index++]; 6c223761eb5482 Kevin Barnett 2016-06-27 2071 log_lun_ext_entry = NULL; 6c223761eb5482 Kevin Barnett 2016-06-27 2072 scsi3addr = phys_lun_ext_entry->lunid; 6c223761eb5482 Kevin Barnett 2016-06-27 2073 } else { 6c223761eb5482 Kevin Barnett 2016-06-27 2074 is_physical_device = false; 6c223761eb5482 Kevin Barnett 2016-06-27 2075 phys_lun_ext_entry = NULL; 6c223761eb5482 Kevin Barnett 2016-06-27 2076 log_lun_ext_entry = 5e6a9760f7da4d Gilbert Wu 2019-08-22 2077 &logdev_list->lun_entries[logical_index++]; 6c223761eb5482 Kevin Barnett 2016-06-27 2078 scsi3addr = log_lun_ext_entry->lunid; 6c223761eb5482 Kevin Barnett 2016-06-27 2079 } 6c223761eb5482 Kevin Barnett 2016-06-27 2080 94086f5be3f15f Kevin Barnett 2017-05-03 2081 if (is_physical_device && pqi_skip_device(scsi3addr)) 6c223761eb5482 Kevin Barnett 2016-06-27 2082 continue; 6c223761eb5482 Kevin Barnett 2016-06-27 2083 6c223761eb5482 Kevin Barnett 2016-06-27 2084 if (device) 6c223761eb5482 Kevin Barnett 2016-06-27 2085 device = list_next_entry(device, new_device_list_entry); 6c223761eb5482 Kevin Barnett 2016-06-27 2086 else 6c223761eb5482 Kevin Barnett 2016-06-27 2087 device = list_first_entry(&new_device_list_head, 6c223761eb5482 Kevin Barnett 2016-06-27 2088 struct pqi_scsi_dev, new_device_list_entry); 6c223761eb5482 Kevin Barnett 2016-06-27 2089 6c223761eb5482 Kevin Barnett 2016-06-27 2090 memcpy(device->scsi3addr, scsi3addr, sizeof(device->scsi3addr)); 6c223761eb5482 Kevin Barnett 2016-06-27 2091 device->is_physical_device = is_physical_device; 3d46a59a191e81 Don Brace 2018-12-07 2092 if (is_physical_device) { 3d46a59a191e81 Don Brace 2018-12-07 2093 if (phys_lun_ext_entry->device_type == 3d46a59a191e81 Don Brace 2018-12-07 2094 SA_EXPANDER_SMP_DEVICE) 3d46a59a191e81 Don Brace 2018-12-07 2095 device->is_expander_smp_device = true; 3d46a59a191e81 Don Brace 2018-12-07 2096 } else { bd10cf0be6057f Kevin Barnett 2017-05-03 2097 device->is_external_raid_device = bd10cf0be6057f Kevin Barnett 2017-05-03 2098 pqi_is_external_raid_addr(scsi3addr); 3d46a59a191e81 Don Brace 2018-12-07 2099 } 6c223761eb5482 Kevin Barnett 2016-06-27 2100 6c223761eb5482 Kevin Barnett 2016-06-27 2101 /* Gather information about the device. */ 6c223761eb5482 Kevin Barnett 2016-06-27 2102 rc = pqi_get_device_info(ctrl_info, device); 6c223761eb5482 Kevin Barnett 2016-06-27 2103 if (rc == -ENOMEM) { 6c223761eb5482 Kevin Barnett 2016-06-27 2104 dev_warn(&ctrl_info->pci_dev->dev, "%s\n", 6c223761eb5482 Kevin Barnett 2016-06-27 2105 out_of_memory_msg); 6c223761eb5482 Kevin Barnett 2016-06-27 2106 goto out; 6c223761eb5482 Kevin Barnett 2016-06-27 2107 } 6c223761eb5482 Kevin Barnett 2016-06-27 2108 if (rc) { 6de783f6662917 Kevin Barnett 2017-05-03 2109 if (device->is_physical_device) 6de783f6662917 Kevin Barnett 2017-05-03 2110 dev_warn(&ctrl_info->pci_dev->dev, 6de783f6662917 Kevin Barnett 2017-05-03 2111 "obtaining device info failed, skipping physical device %016llx\n", 6de783f6662917 Kevin Barnett 2017-05-03 2112 get_unaligned_be64( 6de783f6662917 Kevin Barnett 2017-05-03 2113 &phys_lun_ext_entry->wwid)); 6de783f6662917 Kevin Barnett 2017-05-03 2114 else 6c223761eb5482 Kevin Barnett 2016-06-27 2115 dev_warn(&ctrl_info->pci_dev->dev, 6de783f6662917 Kevin Barnett 2017-05-03 2116 "obtaining device info failed, skipping logical device %08x%08x\n", 6de783f6662917 Kevin Barnett 2017-05-03 2117 *((u32 *)&device->scsi3addr), 6de783f6662917 Kevin Barnett 2017-05-03 2118 *((u32 *)&device->scsi3addr[4])); 6c223761eb5482 Kevin Barnett 2016-06-27 2119 rc = 0; 6c223761eb5482 Kevin Barnett 2016-06-27 2120 continue; 6c223761eb5482 Kevin Barnett 2016-06-27 2121 } 6c223761eb5482 Kevin Barnett 2016-06-27 2122 6c223761eb5482 Kevin Barnett 2016-06-27 2123 if (!pqi_is_supported_device(device)) 6c223761eb5482 Kevin Barnett 2016-06-27 2124 continue; 6c223761eb5482 Kevin Barnett 2016-06-27 2125 6c223761eb5482 Kevin Barnett 2016-06-27 2126 pqi_assign_bus_target_lun(device); 6c223761eb5482 Kevin Barnett 2016-06-27 2127 6c223761eb5482 Kevin Barnett 2016-06-27 2128 if (device->is_physical_device) { 6c223761eb5482 Kevin Barnett 2016-06-27 2129 device->wwid = phys_lun_ext_entry->wwid; 6c223761eb5482 Kevin Barnett 2016-06-27 2130 if ((phys_lun_ext_entry->device_flags & 6c223761eb5482 Kevin Barnett 2016-06-27 2131 REPORT_PHYS_LUN_DEV_FLAG_AIO_ENABLED) && 3d46a59a191e81 Don Brace 2018-12-07 2132 phys_lun_ext_entry->aio_handle) { 6c223761eb5482 Kevin Barnett 2016-06-27 2133 device->aio_enabled = true; 3d46a59a191e81 Don Brace 2018-12-07 2134 device->aio_handle = 3d46a59a191e81 Don Brace 2018-12-07 2135 phys_lun_ext_entry->aio_handle; 6c223761eb5482 Kevin Barnett 2016-06-27 2136 } 6c223761eb5482 Kevin Barnett 2016-06-27 2137 if (device->devtype == TYPE_DISK || 6c223761eb5482 Kevin Barnett 2016-06-27 2138 device->devtype == TYPE_ZBC) { 6c223761eb5482 Kevin Barnett 2016-06-27 2139 pqi_get_physical_disk_info(ctrl_info, 6c223761eb5482 Kevin Barnett 2016-06-27 2140 device, id_phys); 6c223761eb5482 Kevin Barnett 2016-06-27 2141 } 3d46a59a191e81 Don Brace 2018-12-07 2142 } else { 3d46a59a191e81 Don Brace 2018-12-07 2143 memcpy(device->volume_id, log_lun_ext_entry->volume_id, 3d46a59a191e81 Don Brace 2018-12-07 2144 sizeof(device->volume_id)); 6c223761eb5482 Kevin Barnett 2016-06-27 2145 } 6c223761eb5482 Kevin Barnett 2016-06-27 2146 3d46a59a191e81 Don Brace 2018-12-07 2147 if (pqi_is_device_with_sas_address(device)) 3d46a59a191e81 Don Brace 2018-12-07 2148 device->sas_address = get_unaligned_be64(&device->wwid); 6c223761eb5482 Kevin Barnett 2016-06-27 2149 6c223761eb5482 Kevin Barnett 2016-06-27 2150 new_device_list[num_valid_devices++] = device; 6c223761eb5482 Kevin Barnett 2016-06-27 2151 } 6c223761eb5482 Kevin Barnett 2016-06-27 2152 6c223761eb5482 Kevin Barnett 2016-06-27 2153 pqi_update_device_list(ctrl_info, new_device_list, num_valid_devices); 6c223761eb5482 Kevin Barnett 2016-06-27 2154 6c223761eb5482 Kevin Barnett 2016-06-27 2155 out: 6c223761eb5482 Kevin Barnett 2016-06-27 2156 list_for_each_entry_safe(device, next, &new_device_list_head, 6c223761eb5482 Kevin Barnett 2016-06-27 2157 new_device_list_entry) { 6c223761eb5482 Kevin Barnett 2016-06-27 2158 if (device->keep_device) 6c223761eb5482 Kevin Barnett 2016-06-27 2159 continue; 6c223761eb5482 Kevin Barnett 2016-06-27 2160 list_del(&device->new_device_list_entry); 6c223761eb5482 Kevin Barnett 2016-06-27 2161 pqi_free_device(device); 6c223761eb5482 Kevin Barnett 2016-06-27 2162 } 6c223761eb5482 Kevin Barnett 2016-06-27 2163 6c223761eb5482 Kevin Barnett 2016-06-27 2164 kfree(new_device_list); 6c223761eb5482 Kevin Barnett 2016-06-27 2165 kfree(physdev_list); 6c223761eb5482 Kevin Barnett 2016-06-27 2166 kfree(logdev_list); 6c223761eb5482 Kevin Barnett 2016-06-27 2167 kfree(id_phys); 6c223761eb5482 Kevin Barnett 2016-06-27 2168 6c223761eb5482 Kevin Barnett 2016-06-27 2169 return rc; 6c223761eb5482 Kevin Barnett 2016-06-27 2170 } 6c223761eb5482 Kevin Barnett 2016-06-27 2171 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-...@lists.01.org
.config.gz
Description: application/gzip
_______________________________________________ kbuild mailing list -- kbuild@lists.01.org To unsubscribe send an email to kbuild-le...@lists.01.org