drivers/scsi/mpt3sas/mpt3sas_ctl.c:2172 mpt3sas_send_diag_release() warn: inconsistent indenting

From: kernel test robot
Date: Tue Aug 11 2020 - 16:57:05 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 00e4db51259a5f936fec1424b884f029479d3981
commit: c6bdb6a10892d1130638a5e28d1523a813e45d5e scsi: mpt3sas: Print function name in which cmd timed out
date: 7 months ago
config: parisc-randconfig-m031-20200811 (attached as .config)
compiler: hppa-linux-gcc (GCC) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

New smatch warnings:
drivers/scsi/mpt3sas/mpt3sas_ctl.c:2172 mpt3sas_send_diag_release() warn: inconsistent indenting

Old smatch warnings:
drivers/scsi/mpt3sas/mpt3sas_ctl.c:708 _ctl_do_mpt_command() error: copy_from_user() 'mpi_request' too small (65535 vs 4294967292)
drivers/scsi/mpt3sas/mpt3sas_ctl.c:1918 _ctl_diag_register() warn: potential spectre issue 'ioc->diag_buffer_status' [w]
drivers/scsi/mpt3sas/mpt3sas_ctl.c:2060 _ctl_diag_query() warn: potential spectre issue 'ioc->diag_buffer' [r]
drivers/scsi/mpt3sas/mpt3sas_ctl.c:2061 _ctl_diag_query() warn: possible spectre second half. 'request_data'
drivers/scsi/mpt3sas/mpt3sas_ctl.c:2085 _ctl_diag_query() warn: potential spectre issue 'ioc->product_specific' [r]
drivers/scsi/mpt3sas/mpt3sas_ctl.c:2087 _ctl_diag_query() warn: potential spectre issue 'ioc->diag_buffer_sz' [r]
drivers/scsi/mpt3sas/mpt3sas_ctl.c:2089 _ctl_diag_query() warn: potential spectre issue 'ioc->unique_id' [r]
drivers/scsi/mpt3sas/mpt3sas_ctl.c:2090 _ctl_diag_query() warn: potential spectre issue 'ioc->diagnostic_flags' [r]

vim +2172 drivers/scsi/mpt3sas/mpt3sas_ctl.c

f92363d1235949 Sreekanth Reddy 2012-11-30 2099
f92363d1235949 Sreekanth Reddy 2012-11-30 2100 /**
f92363d1235949 Sreekanth Reddy 2012-11-30 2101 * mpt3sas_send_diag_release - Diag Release Message
f92363d1235949 Sreekanth Reddy 2012-11-30 2102 * @ioc: per adapter object
4beb4867f049ae Bart Van Assche 2018-06-15 2103 * @buffer_type: specifies either TRACE, SNAPSHOT, or EXTENDED
4beb4867f049ae Bart Van Assche 2018-06-15 2104 * @issue_reset: specifies whether host reset is required.
f92363d1235949 Sreekanth Reddy 2012-11-30 2105 *
f92363d1235949 Sreekanth Reddy 2012-11-30 2106 */
f92363d1235949 Sreekanth Reddy 2012-11-30 2107 int
f92363d1235949 Sreekanth Reddy 2012-11-30 2108 mpt3sas_send_diag_release(struct MPT3SAS_ADAPTER *ioc, u8 buffer_type,
f92363d1235949 Sreekanth Reddy 2012-11-30 2109 u8 *issue_reset)
f92363d1235949 Sreekanth Reddy 2012-11-30 2110 {
f92363d1235949 Sreekanth Reddy 2012-11-30 2111 Mpi2DiagReleaseRequest_t *mpi_request;
f92363d1235949 Sreekanth Reddy 2012-11-30 2112 Mpi2DiagReleaseReply_t *mpi_reply;
f92363d1235949 Sreekanth Reddy 2012-11-30 2113 u16 smid;
f92363d1235949 Sreekanth Reddy 2012-11-30 2114 u16 ioc_status;
f92363d1235949 Sreekanth Reddy 2012-11-30 2115 u32 ioc_state;
f92363d1235949 Sreekanth Reddy 2012-11-30 2116 int rc;
c6bdb6a10892d1 Sreekanth Reddy 2019-12-26 2117 u8 reset_needed = 0;
f92363d1235949 Sreekanth Reddy 2012-11-30 2118
919d8a3f3fef99 Joe Perches 2018-09-17 2119 dctlprintk(ioc, ioc_info(ioc, "%s\n",
f92363d1235949 Sreekanth Reddy 2012-11-30 2120 __func__));
f92363d1235949 Sreekanth Reddy 2012-11-30 2121
f92363d1235949 Sreekanth Reddy 2012-11-30 2122 rc = 0;
f92363d1235949 Sreekanth Reddy 2012-11-30 2123 *issue_reset = 0;
f92363d1235949 Sreekanth Reddy 2012-11-30 2124
c6bdb6a10892d1 Sreekanth Reddy 2019-12-26 2125
f92363d1235949 Sreekanth Reddy 2012-11-30 2126 ioc_state = mpt3sas_base_get_iocstate(ioc, 1);
f92363d1235949 Sreekanth Reddy 2012-11-30 2127 if (ioc_state != MPI2_IOC_STATE_OPERATIONAL) {
f92363d1235949 Sreekanth Reddy 2012-11-30 2128 if (ioc->diag_buffer_status[buffer_type] &
f92363d1235949 Sreekanth Reddy 2012-11-30 2129 MPT3_DIAG_BUFFER_IS_REGISTERED)
f92363d1235949 Sreekanth Reddy 2012-11-30 2130 ioc->diag_buffer_status[buffer_type] |=
f92363d1235949 Sreekanth Reddy 2012-11-30 2131 MPT3_DIAG_BUFFER_IS_RELEASED;
919d8a3f3fef99 Joe Perches 2018-09-17 2132 dctlprintk(ioc,
919d8a3f3fef99 Joe Perches 2018-09-17 2133 ioc_info(ioc, "%s: skipping due to FAULT state\n",
f92363d1235949 Sreekanth Reddy 2012-11-30 2134 __func__));
f92363d1235949 Sreekanth Reddy 2012-11-30 2135 rc = -EAGAIN;
f92363d1235949 Sreekanth Reddy 2012-11-30 2136 goto out;
f92363d1235949 Sreekanth Reddy 2012-11-30 2137 }
f92363d1235949 Sreekanth Reddy 2012-11-30 2138
f92363d1235949 Sreekanth Reddy 2012-11-30 2139 if (ioc->ctl_cmds.status != MPT3_CMD_NOT_USED) {
919d8a3f3fef99 Joe Perches 2018-09-17 2140 ioc_err(ioc, "%s: ctl_cmd in use\n", __func__);
f92363d1235949 Sreekanth Reddy 2012-11-30 2141 rc = -EAGAIN;
f92363d1235949 Sreekanth Reddy 2012-11-30 2142 goto out;
f92363d1235949 Sreekanth Reddy 2012-11-30 2143 }
f92363d1235949 Sreekanth Reddy 2012-11-30 2144
f92363d1235949 Sreekanth Reddy 2012-11-30 2145 smid = mpt3sas_base_get_smid(ioc, ioc->ctl_cb_idx);
f92363d1235949 Sreekanth Reddy 2012-11-30 2146 if (!smid) {
919d8a3f3fef99 Joe Perches 2018-09-17 2147 ioc_err(ioc, "%s: failed obtaining a smid\n", __func__);
f92363d1235949 Sreekanth Reddy 2012-11-30 2148 rc = -EAGAIN;
f92363d1235949 Sreekanth Reddy 2012-11-30 2149 goto out;
f92363d1235949 Sreekanth Reddy 2012-11-30 2150 }
f92363d1235949 Sreekanth Reddy 2012-11-30 2151
f92363d1235949 Sreekanth Reddy 2012-11-30 2152 ioc->ctl_cmds.status = MPT3_CMD_PENDING;
f92363d1235949 Sreekanth Reddy 2012-11-30 2153 memset(ioc->ctl_cmds.reply, 0, ioc->reply_sz);
f92363d1235949 Sreekanth Reddy 2012-11-30 2154 mpi_request = mpt3sas_base_get_msg_frame(ioc, smid);
f92363d1235949 Sreekanth Reddy 2012-11-30 2155 ioc->ctl_cmds.smid = smid;
f92363d1235949 Sreekanth Reddy 2012-11-30 2156
f92363d1235949 Sreekanth Reddy 2012-11-30 2157 mpi_request->Function = MPI2_FUNCTION_DIAG_RELEASE;
f92363d1235949 Sreekanth Reddy 2012-11-30 2158 mpi_request->BufferType = buffer_type;
f92363d1235949 Sreekanth Reddy 2012-11-30 2159 mpi_request->VF_ID = 0; /* TODO */
f92363d1235949 Sreekanth Reddy 2012-11-30 2160 mpi_request->VP_ID = 0;
f92363d1235949 Sreekanth Reddy 2012-11-30 2161
f92363d1235949 Sreekanth Reddy 2012-11-30 2162 init_completion(&ioc->ctl_cmds.done);
078a4cc1380de7 Suganath Prabu S 2019-05-31 2163 ioc->put_smid_default(ioc, smid);
8bbb1cf63f5e34 Calvin Owens 2016-07-28 2164 wait_for_completion_timeout(&ioc->ctl_cmds.done,
f92363d1235949 Sreekanth Reddy 2012-11-30 2165 MPT3_IOCTL_DEFAULT_TIMEOUT*HZ);
f92363d1235949 Sreekanth Reddy 2012-11-30 2166
f92363d1235949 Sreekanth Reddy 2012-11-30 2167 if (!(ioc->ctl_cmds.status & MPT3_CMD_COMPLETE)) {
c6bdb6a10892d1 Sreekanth Reddy 2019-12-26 2168 mpt3sas_check_cmd_timeout(ioc,
d37306ca0eacdc Chaitra P B 2018-05-31 2169 ioc->ctl_cmds.status, mpi_request,
c6bdb6a10892d1 Sreekanth Reddy 2019-12-26 2170 sizeof(Mpi2DiagReleaseRequest_t)/4, reset_needed);
c6bdb6a10892d1 Sreekanth Reddy 2019-12-26 2171 *issue_reset = reset_needed;
f92363d1235949 Sreekanth Reddy 2012-11-30 @2172 rc = -EFAULT;
f92363d1235949 Sreekanth Reddy 2012-11-30 2173 goto out;
f92363d1235949 Sreekanth Reddy 2012-11-30 2174 }
f92363d1235949 Sreekanth Reddy 2012-11-30 2175
f92363d1235949 Sreekanth Reddy 2012-11-30 2176 /* process the completed Reply Message Frame */
f92363d1235949 Sreekanth Reddy 2012-11-30 2177 if ((ioc->ctl_cmds.status & MPT3_CMD_REPLY_VALID) == 0) {
919d8a3f3fef99 Joe Perches 2018-09-17 2178 ioc_err(ioc, "%s: no reply message\n", __func__);
f92363d1235949 Sreekanth Reddy 2012-11-30 2179 rc = -EFAULT;
f92363d1235949 Sreekanth Reddy 2012-11-30 2180 goto out;
f92363d1235949 Sreekanth Reddy 2012-11-30 2181 }
f92363d1235949 Sreekanth Reddy 2012-11-30 2182
f92363d1235949 Sreekanth Reddy 2012-11-30 2183 mpi_reply = ioc->ctl_cmds.reply;
f92363d1235949 Sreekanth Reddy 2012-11-30 2184 ioc_status = le16_to_cpu(mpi_reply->IOCStatus) & MPI2_IOCSTATUS_MASK;
f92363d1235949 Sreekanth Reddy 2012-11-30 2185
f92363d1235949 Sreekanth Reddy 2012-11-30 2186 if (ioc_status == MPI2_IOCSTATUS_SUCCESS) {
f92363d1235949 Sreekanth Reddy 2012-11-30 2187 ioc->diag_buffer_status[buffer_type] |=
f92363d1235949 Sreekanth Reddy 2012-11-30 2188 MPT3_DIAG_BUFFER_IS_RELEASED;
919d8a3f3fef99 Joe Perches 2018-09-17 2189 dctlprintk(ioc, ioc_info(ioc, "%s: success\n", __func__));
f92363d1235949 Sreekanth Reddy 2012-11-30 2190 } else {
919d8a3f3fef99 Joe Perches 2018-09-17 2191 ioc_info(ioc, "%s: ioc_status(0x%04x) log_info(0x%08x)\n",
919d8a3f3fef99 Joe Perches 2018-09-17 2192 __func__,
f92363d1235949 Sreekanth Reddy 2012-11-30 2193 ioc_status, le32_to_cpu(mpi_reply->IOCLogInfo));
f92363d1235949 Sreekanth Reddy 2012-11-30 2194 rc = -EFAULT;
f92363d1235949 Sreekanth Reddy 2012-11-30 2195 }
f92363d1235949 Sreekanth Reddy 2012-11-30 2196
f92363d1235949 Sreekanth Reddy 2012-11-30 2197 out:
f92363d1235949 Sreekanth Reddy 2012-11-30 2198 ioc->ctl_cmds.status = MPT3_CMD_NOT_USED;
f92363d1235949 Sreekanth Reddy 2012-11-30 2199 return rc;
f92363d1235949 Sreekanth Reddy 2012-11-30 2200 }
f92363d1235949 Sreekanth Reddy 2012-11-30 2201

:::::: The code at line 2172 was first introduced by commit
:::::: f92363d12359498f9a9960511de1a550f0ec41c2 [SCSI] mpt3sas: add new driver supporting 12GB SAS

:::::: TO: Sreekanth Reddy <Sreekanth.Reddy@xxxxxxx>
:::::: CC: James Bottomley <JBottomley@xxxxxxxxxxxxx>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip