.. | .. |
---|
2159 | 2159 | char mybuf[64]; |
---|
2160 | 2160 | char *pbuf; |
---|
2161 | 2161 | int i; |
---|
| 2162 | + size_t bsize; |
---|
2162 | 2163 | |
---|
2163 | 2164 | memset(mybuf, 0, sizeof(mybuf)); |
---|
2164 | 2165 | |
---|
2165 | | - if (copy_from_user(mybuf, buf, nbytes)) |
---|
| 2166 | + bsize = min(nbytes, (sizeof(mybuf) - 1)); |
---|
| 2167 | + |
---|
| 2168 | + if (copy_from_user(mybuf, buf, bsize)) |
---|
2166 | 2169 | return -EFAULT; |
---|
2167 | 2170 | pbuf = &mybuf[0]; |
---|
2168 | 2171 | |
---|
.. | .. |
---|
2183 | 2186 | qp->lock_conflict.wq_access = 0; |
---|
2184 | 2187 | } |
---|
2185 | 2188 | } |
---|
2186 | | - return nbytes; |
---|
| 2189 | + return bsize; |
---|
2187 | 2190 | } |
---|
2188 | 2191 | #endif |
---|
2189 | 2192 | |
---|
.. | .. |
---|
5906 | 5909 | phba->hba_debugfs_root, |
---|
5907 | 5910 | phba, |
---|
5908 | 5911 | &lpfc_debugfs_op_multixripools); |
---|
5909 | | - if (!phba->debug_multixri_pools) { |
---|
| 5912 | + if (IS_ERR(phba->debug_multixri_pools)) { |
---|
5910 | 5913 | lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT, |
---|
5911 | 5914 | "0527 Cannot create debugfs multixripools\n"); |
---|
5912 | 5915 | goto debug_failed; |
---|
.. | .. |
---|
5918 | 5921 | debugfs_create_file(name, 0644, |
---|
5919 | 5922 | phba->hba_debugfs_root, |
---|
5920 | 5923 | phba, &lpfc_debugfs_ras_log); |
---|
5921 | | - if (!phba->debug_ras_log) { |
---|
| 5924 | + if (IS_ERR(phba->debug_ras_log)) { |
---|
5922 | 5925 | lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT, |
---|
5923 | 5926 | "6148 Cannot create debugfs" |
---|
5924 | 5927 | " ras_log\n"); |
---|
.. | .. |
---|
5939 | 5942 | debugfs_create_file(name, S_IFREG | 0644, |
---|
5940 | 5943 | phba->hba_debugfs_root, |
---|
5941 | 5944 | phba, &lpfc_debugfs_op_lockstat); |
---|
5942 | | - if (!phba->debug_lockstat) { |
---|
| 5945 | + if (IS_ERR(phba->debug_lockstat)) { |
---|
5943 | 5946 | lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT, |
---|
5944 | 5947 | "4610 Can't create debugfs lockstat\n"); |
---|
5945 | 5948 | goto debug_failed; |
---|
.. | .. |
---|
6168 | 6171 | debugfs_create_file(name, 0644, |
---|
6169 | 6172 | vport->vport_debugfs_root, |
---|
6170 | 6173 | vport, &lpfc_debugfs_op_scsistat); |
---|
6171 | | - if (!vport->debug_scsistat) { |
---|
| 6174 | + if (IS_ERR(vport->debug_scsistat)) { |
---|
6172 | 6175 | lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT, |
---|
6173 | 6176 | "4611 Cannot create debugfs scsistat\n"); |
---|
6174 | 6177 | goto debug_failed; |
---|
.. | .. |
---|
6179 | 6182 | debugfs_create_file(name, 0644, |
---|
6180 | 6183 | vport->vport_debugfs_root, |
---|
6181 | 6184 | vport, &lpfc_debugfs_op_ioktime); |
---|
6182 | | - if (!vport->debug_ioktime) { |
---|
| 6185 | + if (IS_ERR(vport->debug_ioktime)) { |
---|
6183 | 6186 | lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT, |
---|
6184 | 6187 | "0815 Cannot create debugfs ioktime\n"); |
---|
6185 | 6188 | goto debug_failed; |
---|