| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright (c) 2005-2014 Brocade Communications Systems, Inc. |
|---|
| 3 | 4 | * Copyright (c) 2014- QLogic Corporation. |
|---|
| .. | .. |
|---|
| 5 | 6 | * www.qlogic.com |
|---|
| 6 | 7 | * |
|---|
| 7 | 8 | * Linux driver for QLogic BR-series Fibre Channel Host Bus Adapter. |
|---|
| 8 | | - * |
|---|
| 9 | | - * This program is free software; you can redistribute it and/or modify it |
|---|
| 10 | | - * under the terms of the GNU General Public License (GPL) Version 2 as |
|---|
| 11 | | - * published by the Free Software Foundation |
|---|
| 12 | | - * |
|---|
| 13 | | - * This program is distributed in the hope that it will be useful, but |
|---|
| 14 | | - * WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 15 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|---|
| 16 | | - * General Public License for more details. |
|---|
| 17 | 9 | */ |
|---|
| 18 | 10 | |
|---|
| 19 | 11 | #include "bfad_drv.h" |
|---|
| .. | .. |
|---|
| 1291 | 1283 | n2n_port->reply_oxid = 0; |
|---|
| 1292 | 1284 | } |
|---|
| 1293 | 1285 | |
|---|
| 1294 | | -void |
|---|
| 1286 | +static void |
|---|
| 1295 | 1287 | bfa_fcport_get_loop_attr(struct bfa_fcs_lport_s *port) |
|---|
| 1296 | 1288 | { |
|---|
| 1297 | 1289 | int i = 0, j = 0, bit = 0, alpa_bit = 0; |
|---|
| .. | .. |
|---|
| 1416 | 1408 | u32 resid_len, |
|---|
| 1417 | 1409 | struct fchs_s *rsp_fchs); |
|---|
| 1418 | 1410 | static void bfa_fcs_lport_fdmi_timeout(void *arg); |
|---|
| 1419 | | -static u16 bfa_fcs_lport_fdmi_build_rhba_pyld(struct bfa_fcs_lport_fdmi_s *fdmi, |
|---|
| 1411 | +static int bfa_fcs_lport_fdmi_build_rhba_pyld(struct bfa_fcs_lport_fdmi_s *fdmi, |
|---|
| 1420 | 1412 | u8 *pyld); |
|---|
| 1421 | 1413 | static u16 bfa_fcs_lport_fdmi_build_rprt_pyld(struct bfa_fcs_lport_fdmi_s *fdmi, |
|---|
| 1422 | 1414 | u8 *pyld); |
|---|
| .. | .. |
|---|
| 1895 | 1887 | bfa_fcs_lport_fdmi_build_rhba_pyld(fdmi, |
|---|
| 1896 | 1888 | (u8 *) ((struct ct_hdr_s *) pyld |
|---|
| 1897 | 1889 | + 1)); |
|---|
| 1890 | + if (attr_len < 0) |
|---|
| 1891 | + return; |
|---|
| 1898 | 1892 | |
|---|
| 1899 | 1893 | bfa_fcxp_send(fcxp, NULL, port->fabric->vf_id, port->lp_tag, BFA_FALSE, |
|---|
| 1900 | 1894 | FC_CLASS_3, (len + attr_len), &fchs, |
|---|
| .. | .. |
|---|
| 1904 | 1898 | bfa_sm_send_event(fdmi, FDMISM_EVENT_RHBA_SENT); |
|---|
| 1905 | 1899 | } |
|---|
| 1906 | 1900 | |
|---|
| 1907 | | -static u16 |
|---|
| 1901 | +static int |
|---|
| 1908 | 1902 | bfa_fcs_lport_fdmi_build_rhba_pyld(struct bfa_fcs_lport_fdmi_s *fdmi, u8 *pyld) |
|---|
| 1909 | 1903 | { |
|---|
| 1910 | 1904 | struct bfa_fcs_lport_s *port = fdmi->ms->port; |
|---|
| 1911 | | - struct bfa_fcs_fdmi_hba_attr_s hba_attr; |
|---|
| 1912 | | - struct bfa_fcs_fdmi_hba_attr_s *fcs_hba_attr = &hba_attr; |
|---|
| 1905 | + struct bfa_fcs_fdmi_hba_attr_s *fcs_hba_attr; |
|---|
| 1913 | 1906 | struct fdmi_rhba_s *rhba = (struct fdmi_rhba_s *) pyld; |
|---|
| 1914 | 1907 | struct fdmi_attr_s *attr; |
|---|
| 1908 | + int len; |
|---|
| 1915 | 1909 | u8 *curr_ptr; |
|---|
| 1916 | | - u16 len, count; |
|---|
| 1917 | | - u16 templen; |
|---|
| 1910 | + u16 templen, count; |
|---|
| 1911 | + |
|---|
| 1912 | + fcs_hba_attr = kzalloc(sizeof(*fcs_hba_attr), GFP_KERNEL); |
|---|
| 1913 | + if (!fcs_hba_attr) |
|---|
| 1914 | + return -ENOMEM; |
|---|
| 1918 | 1915 | |
|---|
| 1919 | 1916 | /* |
|---|
| 1920 | 1917 | * get hba attributes |
|---|
| .. | .. |
|---|
| 2156 | 2153 | len += ((sizeof(attr->type) + sizeof(attr->len)) * count); |
|---|
| 2157 | 2154 | |
|---|
| 2158 | 2155 | rhba->hba_attr_blk.attr_count = cpu_to_be32(count); |
|---|
| 2156 | + |
|---|
| 2157 | + kfree(fcs_hba_attr); |
|---|
| 2158 | + |
|---|
| 2159 | 2159 | return len; |
|---|
| 2160 | 2160 | } |
|---|
| 2161 | 2161 | |
|---|
| .. | .. |
|---|
| 4366 | 4366 | bfa_sm_set_state(ns, |
|---|
| 4367 | 4367 | bfa_fcs_lport_ns_sm_sending_gid_ft); |
|---|
| 4368 | 4368 | bfa_fcs_lport_ns_send_gid_ft(ns, NULL); |
|---|
| 4369 | | - }; |
|---|
| 4369 | + } |
|---|
| 4370 | 4370 | break; |
|---|
| 4371 | 4371 | |
|---|
| 4372 | 4372 | default: |
|---|
| .. | .. |
|---|
| 6430 | 6430 | switch (event) { |
|---|
| 6431 | 6431 | case BFA_FCS_VPORT_SM_OFFLINE: |
|---|
| 6432 | 6432 | bfa_sm_send_event(vport->lps, BFA_LPS_SM_OFFLINE); |
|---|
| 6433 | | - /* |
|---|
| 6434 | | - * !!! fall through !!! |
|---|
| 6435 | | - */ |
|---|
| 6433 | + fallthrough; |
|---|
| 6436 | 6434 | |
|---|
| 6437 | 6435 | case BFA_FCS_VPORT_SM_RSP_OK: |
|---|
| 6438 | 6436 | case BFA_FCS_VPORT_SM_RSP_ERROR: |
|---|
| .. | .. |
|---|
| 6458 | 6456 | switch (event) { |
|---|
| 6459 | 6457 | case BFA_FCS_VPORT_SM_OFFLINE: |
|---|
| 6460 | 6458 | bfa_sm_send_event(vport->lps, BFA_LPS_SM_OFFLINE); |
|---|
| 6461 | | - /* |
|---|
| 6462 | | - * !!! fall through !!! |
|---|
| 6463 | | - */ |
|---|
| 6459 | + fallthrough; |
|---|
| 6464 | 6460 | |
|---|
| 6465 | 6461 | case BFA_FCS_VPORT_SM_RSP_OK: |
|---|
| 6466 | 6462 | case BFA_FCS_VPORT_SM_RSP_ERROR: |
|---|