get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/1319416/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 1319416,
    "url": "http://patchwork.ozlabs.org/api/patches/1319416/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20200630002746.64140-2-anthony.l.nguyen@intel.com/",
    "project": {
        "id": 46,
        "url": "http://patchwork.ozlabs.org/api/projects/46/?format=api",
        "name": "Intel Wired Ethernet development",
        "link_name": "intel-wired-lan",
        "list_id": "intel-wired-lan.osuosl.org",
        "list_email": "intel-wired-lan@osuosl.org",
        "web_url": "",
        "scm_url": "",
        "webscm_url": "",
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<20200630002746.64140-2-anthony.l.nguyen@intel.com>",
    "list_archive_url": null,
    "date": "2020-06-30T00:27:46",
    "name": "[2/2] ice: replace single-element array used for C struct hack",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "7f8a09a6827476633059bd99fc7a8ac690e22135",
    "submitter": {
        "id": 68875,
        "url": "http://patchwork.ozlabs.org/api/people/68875/?format=api",
        "name": "Tony Nguyen",
        "email": "anthony.l.nguyen@intel.com"
    },
    "delegate": {
        "id": 68,
        "url": "http://patchwork.ozlabs.org/api/users/68/?format=api",
        "username": "jtkirshe",
        "first_name": "Jeff",
        "last_name": "Kirsher",
        "email": "jeffrey.t.kirsher@intel.com"
    },
    "mbox": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20200630002746.64140-2-anthony.l.nguyen@intel.com/mbox/",
    "series": [
        {
            "id": 186543,
            "url": "http://patchwork.ozlabs.org/api/series/186543/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/list/?series=186543",
            "date": "2020-06-30T00:27:46",
            "name": "[1/2] ice: avoid unnecessary single-member variable-length structs",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/186543/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/1319416/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/1319416/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<intel-wired-lan-bounces@osuosl.org>",
        "X-Original-To": [
            "incoming@patchwork.ozlabs.org",
            "intel-wired-lan@lists.osuosl.org"
        ],
        "Delivered-To": [
            "patchwork-incoming@bilbo.ozlabs.org",
            "intel-wired-lan@lists.osuosl.org"
        ],
        "Authentication-Results": [
            "ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=osuosl.org\n (client-ip=140.211.166.137; helo=fraxinus.osuosl.org;\n envelope-from=intel-wired-lan-bounces@osuosl.org; receiver=<UNKNOWN>)",
            "ozlabs.org;\n dmarc=fail (p=none dis=none) header.from=intel.com"
        ],
        "Received": [
            "from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 49wlfH3qK2z9sQx\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 30 Jun 2020 10:31:35 +1000 (AEST)",
            "from localhost (localhost [127.0.0.1])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id 3006E8703D;\n\tTue, 30 Jun 2020 00:31:33 +0000 (UTC)",
            "from fraxinus.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id M-EcnIoRCzpU; Tue, 30 Jun 2020 00:31:28 +0000 (UTC)",
            "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id 7B9C986F72;\n\tTue, 30 Jun 2020 00:31:28 +0000 (UTC)",
            "from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138])\n by ash.osuosl.org (Postfix) with ESMTP id 0EB091BF2CD\n for <intel-wired-lan@lists.osuosl.org>; Tue, 30 Jun 2020 00:31:27 +0000 (UTC)",
            "from localhost (localhost [127.0.0.1])\n by whitealder.osuosl.org (Postfix) with ESMTP id 0777488544\n for <intel-wired-lan@lists.osuosl.org>; Tue, 30 Jun 2020 00:31:27 +0000 (UTC)",
            "from whitealder.osuosl.org ([127.0.0.1])\n by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n with ESMTP id mAo68DSNvvdU for <intel-wired-lan@lists.osuosl.org>;\n Tue, 30 Jun 2020 00:31:23 +0000 (UTC)",
            "from mga09.intel.com (mga09.intel.com [134.134.136.24])\n by whitealder.osuosl.org (Postfix) with ESMTPS id AE1058852D\n for <intel-wired-lan@lists.osuosl.org>; Tue, 30 Jun 2020 00:31:23 +0000 (UTC)",
            "from orsmga007.jf.intel.com ([10.7.209.58])\n by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 29 Jun 2020 17:31:22 -0700",
            "from unknown (HELO localhost.jf.intel.com) ([10.166.241.65])\n by orsmga007.jf.intel.com with ESMTP; 29 Jun 2020 17:31:22 -0700"
        ],
        "X-Virus-Scanned": [
            "amavisd-new at osuosl.org",
            "amavisd-new at osuosl.org"
        ],
        "X-Greylist": "domain auto-whitelisted by SQLgrey-1.7.6",
        "IronPort-SDR": [
            "\n Q0nnyFufTha2Cl/+f52szKIxttJrgfFQBwxOjFCFCb7rco+kULFYQhgVyFForqRpxYZL7jLe8r\n oVpdimPmEpMw==",
            "\n XdK4W7QjRJ5rn5G8LkpJa97cMeg9ITBf18TOZtdhwBY18Sqogsc+bEvSJkmI6TO9kFssJyTtup\n cpRI7K1g5QWg=="
        ],
        "X-IronPort-AV": [
            "E=McAfee;i=\"6000,8403,9666\"; a=\"147662197\"",
            "E=Sophos;i=\"5.75,296,1589266800\"; d=\"scan'208\";a=\"147662197\"",
            "E=Sophos;i=\"5.75,296,1589266800\"; d=\"scan'208\";a=\"320372873\""
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "From": "Tony Nguyen <anthony.l.nguyen@intel.com>",
        "To": "intel-wired-lan@lists.osuosl.org",
        "Date": "Mon, 29 Jun 2020 17:27:46 -0700",
        "Message-Id": "<20200630002746.64140-2-anthony.l.nguyen@intel.com>",
        "X-Mailer": "git-send-email 2.20.1",
        "In-Reply-To": "<20200630002746.64140-1-anthony.l.nguyen@intel.com>",
        "References": "<20200630002746.64140-1-anthony.l.nguyen@intel.com>",
        "MIME-Version": "1.0",
        "Subject": "[Intel-wired-lan] [PATCH 2/2] ice: replace single-element array\n used for C struct hack",
        "X-BeenThere": "intel-wired-lan@osuosl.org",
        "X-Mailman-Version": "2.1.29",
        "Precedence": "list",
        "List-Id": "Intel Wired Ethernet Linux Kernel Driver Development\n <intel-wired-lan.osuosl.org>",
        "List-Unsubscribe": "<https://lists.osuosl.org/mailman/options/intel-wired-lan>,\n <mailto:intel-wired-lan-request@osuosl.org?subject=unsubscribe>",
        "List-Archive": "<http://lists.osuosl.org/pipermail/intel-wired-lan/>",
        "List-Post": "<mailto:intel-wired-lan@osuosl.org>",
        "List-Help": "<mailto:intel-wired-lan-request@osuosl.org?subject=help>",
        "List-Subscribe": "<https://lists.osuosl.org/mailman/listinfo/intel-wired-lan>,\n <mailto:intel-wired-lan-request@osuosl.org?subject=subscribe>",
        "Content-Type": "text/plain; charset=\"us-ascii\"",
        "Content-Transfer-Encoding": "7bit",
        "Errors-To": "intel-wired-lan-bounces@osuosl.org",
        "Sender": "\"Intel-wired-lan\" <intel-wired-lan-bounces@osuosl.org>"
    },
    "content": "From: Bruce Allan <bruce.w.allan@intel.com>\n\nConvert the pre-C90-extension \"C struct hack\" method (using a single-\nelement array at the end of a structure for implementing variable-length\ntypes) to the preferred use of C99 flexible array member.\n\nAdditional code cleanups were done near areas affected by this change.\n\nSigned-off-by: Bruce Allan <bruce.w.allan@intel.com>\nSigned-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>\n---\n .../net/ethernet/intel/ice/ice_adminq_cmd.h   | 23 +++---\n drivers/net/ethernet/intel/ice/ice_base.c     |  2 +-\n drivers/net/ethernet/intel/ice/ice_common.c   | 74 ++++++++++---------\n drivers/net/ethernet/intel/ice/ice_dcb.h      |  4 +-\n .../net/ethernet/intel/ice/ice_flex_pipe.c    | 35 +++++----\n .../net/ethernet/intel/ice/ice_flex_type.h    | 39 +++++-----\n drivers/net/ethernet/intel/ice/ice_lib.c      |  2 +-\n drivers/net/ethernet/intel/ice/ice_sched.c    |  4 +-\n drivers/net/ethernet/intel/ice/ice_switch.c   | 36 ++++-----\n drivers/net/ethernet/intel/ice/ice_xsk.c      |  6 +-\n 10 files changed, 111 insertions(+), 114 deletions(-)",
    "diff": "diff --git a/drivers/net/ethernet/intel/ice/ice_adminq_cmd.h b/drivers/net/ethernet/intel/ice/ice_adminq_cmd.h\nindex a55dc1594daa..99c39249613a 100644\n--- a/drivers/net/ethernet/intel/ice/ice_adminq_cmd.h\n+++ b/drivers/net/ethernet/intel/ice/ice_adminq_cmd.h\n@@ -267,7 +267,7 @@ struct ice_aqc_alloc_free_res_elem {\n #define ICE_AQC_RES_TYPE_VSI_PRUNE_LIST_M\t\\\n \t\t\t\t(0xF << ICE_AQC_RES_TYPE_VSI_PRUNE_LIST_S)\n \t__le16 num_elems;\n-\tstruct ice_aqc_res_elem elem[1];\n+\tstruct ice_aqc_res_elem elem[];\n };\n \n /* Add VSI (indirect 0x0210)\n@@ -561,8 +561,8 @@ struct ice_sw_rule_lkup_rx_tx {\n \t * lookup-type\n \t */\n \t__le16 hdr_len;\n-\tu8 hdr[1];\n-} __packed;\n+\tu8 hdr[];\n+};\n \n /* Add/Update/Remove large action command/response entry\n  * \"index\" is returned as part of a response to a successful Add command, and\n@@ -571,7 +571,6 @@ struct ice_sw_rule_lkup_rx_tx {\n struct ice_sw_rule_lg_act {\n \t__le16 index; /* Index in large action table */\n \t__le16 size;\n-\t__le32 act[1]; /* array of size for actions */\n \t/* Max number of large actions */\n #define ICE_MAX_LG_ACT\t4\n \t/* Bit 0:1 - Action type */\n@@ -622,6 +621,7 @@ struct ice_sw_rule_lg_act {\n #define ICE_LG_ACT_STAT_COUNT\t\t0x7\n #define ICE_LG_ACT_STAT_COUNT_S\t\t3\n #define ICE_LG_ACT_STAT_COUNT_M\t\t(0x7F << ICE_LG_ACT_STAT_COUNT_S)\n+\t__le32 act[]; /* array of size for actions */\n };\n \n /* Add/Update/Remove VSI list command/response entry\n@@ -631,7 +631,7 @@ struct ice_sw_rule_lg_act {\n struct ice_sw_rule_vsi_list {\n \t__le16 index; /* Index of VSI/Prune list */\n \t__le16 number_vsi;\n-\t__le16 vsi[1]; /* Array of number_vsi VSI numbers */\n+\t__le16 vsi[]; /* Array of number_vsi VSI numbers */\n };\n \n /* Query VSI list command/response entry */\n@@ -738,7 +738,7 @@ struct ice_aqc_txsched_topo_grp_info_hdr {\n \n struct ice_aqc_add_elem {\n \tstruct ice_aqc_txsched_topo_grp_info_hdr hdr;\n-\tstruct ice_aqc_txsched_elem_data generic[1];\n+\tstruct ice_aqc_txsched_elem_data generic[];\n };\n \n struct ice_aqc_get_topo_elem {\n@@ -749,7 +749,7 @@ struct ice_aqc_get_topo_elem {\n \n struct ice_aqc_delete_elem {\n \tstruct ice_aqc_txsched_topo_grp_info_hdr hdr;\n-\t__le32 teid[1];\n+\t__le32 teid[];\n };\n \n /* Query Port ETS (indirect 0x040E)\n@@ -1510,7 +1510,7 @@ struct ice_aqc_add_tx_qgrp {\n \t__le32 parent_teid;\n \tu8 num_txqs;\n \tu8 rsvd[3];\n-\tstruct ice_aqc_add_txqs_perq txqs[1];\n+\tstruct ice_aqc_add_txqs_perq txqs[];\n };\n \n /* Disable Tx LAN Queues (indirect 0x0C31) */\n@@ -1548,14 +1548,13 @@ struct ice_aqc_dis_txq_item {\n \tu8 num_qs;\n \tu8 rsvd;\n \t/* The length of the q_id array varies according to num_qs */\n-\t__le16 q_id[1];\n-\t/* This only applies from F8 onward */\n #define ICE_AQC_Q_DIS_BUF_ELEM_TYPE_S\t\t15\n #define ICE_AQC_Q_DIS_BUF_ELEM_TYPE_LAN_Q\t\\\n \t\t\t(0 << ICE_AQC_Q_DIS_BUF_ELEM_TYPE_S)\n #define ICE_AQC_Q_DIS_BUF_ELEM_TYPE_RDMA_QSET\t\\\n \t\t\t(1 << ICE_AQC_Q_DIS_BUF_ELEM_TYPE_S)\n-};\n+\t__le16 q_id[];\n+} __packed;\n \n /* Configure Firmware Logging Command (indirect 0xFF09)\n  * Logging Information Read Response (indirect 0xFF10)\n@@ -1679,7 +1678,7 @@ struct ice_aqc_get_pkg_info {\n /* Get Package Info List response buffer format (0x0C43) */\n struct ice_aqc_get_pkg_info_resp {\n \t__le32 count;\n-\tstruct ice_aqc_get_pkg_info pkg_info[1];\n+\tstruct ice_aqc_get_pkg_info pkg_info[];\n };\n \n /* Lan Queue Overflow Event (direct, 0x1001) */\ndiff --git a/drivers/net/ethernet/intel/ice/ice_base.c b/drivers/net/ethernet/intel/ice/ice_base.c\nindex d620d26d42ed..87008476d8fe 100644\n--- a/drivers/net/ethernet/intel/ice/ice_base.c\n+++ b/drivers/net/ethernet/intel/ice/ice_base.c\n@@ -635,10 +635,10 @@ int\n ice_vsi_cfg_txq(struct ice_vsi *vsi, struct ice_ring *ring,\n \t\tstruct ice_aqc_add_tx_qgrp *qg_buf)\n {\n+\tu8 buf_len = struct_size(qg_buf, txqs, 1);\n \tstruct ice_tlan_ctx tlan_ctx = { 0 };\n \tstruct ice_aqc_add_txqs_perq *txq;\n \tstruct ice_pf *pf = vsi->back;\n-\tu8 buf_len = sizeof(*qg_buf);\n \tstruct ice_hw *hw = &pf->hw;\n \tenum ice_status status;\n \tu16 pf_q;\ndiff --git a/drivers/net/ethernet/intel/ice/ice_common.c b/drivers/net/ethernet/intel/ice/ice_common.c\nindex 622ab1f0e18f..57fd815c41bc 100644\n--- a/drivers/net/ethernet/intel/ice/ice_common.c\n+++ b/drivers/net/ethernet/intel/ice/ice_common.c\n@@ -1536,7 +1536,7 @@ ice_alloc_hw_res(struct ice_hw *hw, u16 type, u16 num, bool btm, u16 *res)\n \tenum ice_status status;\n \tu16 buf_len;\n \n-\tbuf_len = struct_size(buf, elem, num - 1);\n+\tbuf_len = struct_size(buf, elem, num);\n \tbuf = kzalloc(buf_len, GFP_KERNEL);\n \tif (!buf)\n \t\treturn ICE_ERR_NO_MEMORY;\n@@ -1553,7 +1553,7 @@ ice_alloc_hw_res(struct ice_hw *hw, u16 type, u16 num, bool btm, u16 *res)\n \tif (status)\n \t\tgoto ice_alloc_res_exit;\n \n-\tmemcpy(res, buf->elem, sizeof(buf->elem) * num);\n+\tmemcpy(res, buf->elem, sizeof(*buf->elem) * num);\n \n ice_alloc_res_exit:\n \tkfree(buf);\n@@ -1574,7 +1574,7 @@ ice_free_hw_res(struct ice_hw *hw, u16 type, u16 num, u16 *res)\n \tenum ice_status status;\n \tu16 buf_len;\n \n-\tbuf_len = struct_size(buf, elem, num - 1);\n+\tbuf_len = struct_size(buf, elem, num);\n \tbuf = kzalloc(buf_len, GFP_KERNEL);\n \tif (!buf)\n \t\treturn ICE_ERR_NO_MEMORY;\n@@ -1582,7 +1582,7 @@ ice_free_hw_res(struct ice_hw *hw, u16 type, u16 num, u16 *res)\n \t/* Prepare buffer to free resource. */\n \tbuf->num_elems = cpu_to_le16(num);\n \tbuf->res_type = cpu_to_le16(type);\n-\tmemcpy(buf->elem, res, sizeof(buf->elem) * num);\n+\tmemcpy(buf->elem, res, sizeof(*buf->elem) * num);\n \n \tstatus = ice_aq_alloc_free_res(hw, num, buf, buf_len,\n \t\t\t\t       ice_aqc_opc_free_res, NULL);\n@@ -2922,10 +2922,10 @@ ice_aq_add_lan_txq(struct ice_hw *hw, u8 num_qgrps,\n \t\t   struct ice_aqc_add_tx_qgrp *qg_list, u16 buf_size,\n \t\t   struct ice_sq_cd *cd)\n {\n-\tu16 i, sum_header_size, sum_q_size = 0;\n \tstruct ice_aqc_add_tx_qgrp *list;\n \tstruct ice_aqc_add_txqs *cmd;\n \tstruct ice_aq_desc desc;\n+\tu16 i, sum_size = 0;\n \n \tcmd = &desc.params.add_txqs;\n \n@@ -2937,18 +2937,13 @@ ice_aq_add_lan_txq(struct ice_hw *hw, u8 num_qgrps,\n \tif (num_qgrps > ICE_LAN_TXQ_MAX_QGRPS)\n \t\treturn ICE_ERR_PARAM;\n \n-\tsum_header_size = num_qgrps *\n-\t\t(sizeof(*qg_list) - sizeof(*qg_list->txqs));\n-\n-\tlist = qg_list;\n-\tfor (i = 0; i < num_qgrps; i++) {\n-\t\tstruct ice_aqc_add_txqs_perq *q = list->txqs;\n-\n-\t\tsum_q_size += list->num_txqs * sizeof(*q);\n-\t\tlist = (struct ice_aqc_add_tx_qgrp *)(q + list->num_txqs);\n+\tfor (i = 0, list = qg_list; i < num_qgrps; i++) {\n+\t\tsum_size += struct_size(list, txqs, list->num_txqs);\n+\t\tlist = (struct ice_aqc_add_tx_qgrp *)(list->txqs +\n+\t\t\t\t\t\t      list->num_txqs);\n \t}\n \n-\tif (buf_size != (sum_header_size + sum_q_size))\n+\tif (buf_size != sum_size)\n \t\treturn ICE_ERR_PARAM;\n \n \tdesc.flags |= cpu_to_le16(ICE_AQ_FLAG_RD);\n@@ -2976,6 +2971,7 @@ ice_aq_dis_lan_txq(struct ice_hw *hw, u8 num_qgrps,\n \t\t   enum ice_disq_rst_src rst_src, u16 vmvf_num,\n \t\t   struct ice_sq_cd *cd)\n {\n+\tstruct ice_aqc_dis_txq_item *item;\n \tstruct ice_aqc_dis_txqs *cmd;\n \tstruct ice_aq_desc desc;\n \tenum ice_status status;\n@@ -3025,16 +3021,16 @@ ice_aq_dis_lan_txq(struct ice_hw *hw, u8 num_qgrps,\n \t */\n \tdesc.flags |= cpu_to_le16(ICE_AQ_FLAG_RD);\n \n-\tfor (i = 0; i < num_qgrps; ++i) {\n-\t\t/* Calculate the size taken up by the queue IDs in this group */\n-\t\tsz += qg_list[i].num_qs * sizeof(qg_list[i].q_id);\n-\n-\t\t/* Add the size of the group header */\n-\t\tsz += sizeof(qg_list[i]) - sizeof(qg_list[i].q_id);\n+\tfor (i = 0, item = qg_list; i < num_qgrps; i++) {\n+\t\tu16 item_size = struct_size(item, q_id, item->num_qs);\n \n \t\t/* If the num of queues is even, add 2 bytes of padding */\n-\t\tif ((qg_list[i].num_qs % 2) == 0)\n-\t\t\tsz += 2;\n+\t\tif ((item->num_qs % 2) == 0)\n+\t\t\titem_size += 2;\n+\n+\t\tsz += item_size;\n+\n+\t\titem = (struct ice_aqc_dis_txq_item *)((u8 *)item + item_size);\n \t}\n \n \tif (buf_size != sz)\n@@ -3423,24 +3419,32 @@ ice_dis_vsi_txq(struct ice_port_info *pi, u16 vsi_handle, u8 tc, u8 num_queues,\n \t\tstruct ice_sq_cd *cd)\n {\n \tenum ice_status status = ICE_ERR_DOES_NOT_EXIST;\n-\tstruct ice_aqc_dis_txq_item qg_list;\n+\tstruct ice_aqc_dis_txq_item *qg_list;\n \tstruct ice_q_ctx *q_ctx;\n-\tu16 i;\n+\tstruct ice_hw *hw;\n+\tu16 i, buf_size;\n \n \tif (!pi || pi->port_state != ICE_SCHED_PORT_STATE_READY)\n \t\treturn ICE_ERR_CFG;\n \n+\thw = pi->hw;\n+\n \tif (!num_queues) {\n \t\t/* if queue is disabled already yet the disable queue command\n \t\t * has to be sent to complete the VF reset, then call\n \t\t * ice_aq_dis_lan_txq without any queue information\n \t\t */\n \t\tif (rst_src)\n-\t\t\treturn ice_aq_dis_lan_txq(pi->hw, 0, NULL, 0, rst_src,\n+\t\t\treturn ice_aq_dis_lan_txq(hw, 0, NULL, 0, rst_src,\n \t\t\t\t\t\t  vmvf_num, NULL);\n \t\treturn ICE_ERR_CFG;\n \t}\n \n+\tbuf_size = struct_size(qg_list, q_id, 1);\n+\tqg_list = kzalloc(buf_size, GFP_KERNEL);\n+\tif (!qg_list)\n+\t\treturn ICE_ERR_NO_MEMORY;\n+\n \tmutex_lock(&pi->sched_lock);\n \n \tfor (i = 0; i < num_queues; i++) {\n@@ -3449,23 +3453,22 @@ ice_dis_vsi_txq(struct ice_port_info *pi, u16 vsi_handle, u8 tc, u8 num_queues,\n \t\tnode = ice_sched_find_node_by_teid(pi->root, q_teids[i]);\n \t\tif (!node)\n \t\t\tcontinue;\n-\t\tq_ctx = ice_get_lan_q_ctx(pi->hw, vsi_handle, tc, q_handles[i]);\n+\t\tq_ctx = ice_get_lan_q_ctx(hw, vsi_handle, tc, q_handles[i]);\n \t\tif (!q_ctx) {\n-\t\t\tice_debug(pi->hw, ICE_DBG_SCHED, \"invalid queue handle%d\\n\",\n+\t\t\tice_debug(hw, ICE_DBG_SCHED, \"invalid queue handle%d\\n\",\n \t\t\t\t  q_handles[i]);\n \t\t\tcontinue;\n \t\t}\n \t\tif (q_ctx->q_handle != q_handles[i]) {\n-\t\t\tice_debug(pi->hw, ICE_DBG_SCHED, \"Err:handles %d %d\\n\",\n+\t\t\tice_debug(hw, ICE_DBG_SCHED, \"Err:handles %d %d\\n\",\n \t\t\t\t  q_ctx->q_handle, q_handles[i]);\n \t\t\tcontinue;\n \t\t}\n-\t\tqg_list.parent_teid = node->info.parent_teid;\n-\t\tqg_list.num_qs = 1;\n-\t\tqg_list.q_id[0] = cpu_to_le16(q_ids[i]);\n-\t\tstatus = ice_aq_dis_lan_txq(pi->hw, 1, &qg_list,\n-\t\t\t\t\t    sizeof(qg_list), rst_src, vmvf_num,\n-\t\t\t\t\t    cd);\n+\t\tqg_list->parent_teid = node->info.parent_teid;\n+\t\tqg_list->num_qs = 1;\n+\t\tqg_list->q_id[0] = cpu_to_le16(q_ids[i]);\n+\t\tstatus = ice_aq_dis_lan_txq(hw, 1, qg_list, buf_size, rst_src,\n+\t\t\t\t\t    vmvf_num, cd);\n \n \t\tif (status)\n \t\t\tbreak;\n@@ -3473,6 +3476,7 @@ ice_dis_vsi_txq(struct ice_port_info *pi, u16 vsi_handle, u8 tc, u8 num_queues,\n \t\tq_ctx->q_handle = ICE_INVAL_Q_HANDLE;\n \t}\n \tmutex_unlock(&pi->sched_lock);\n+\tkfree(qg_list);\n \treturn status;\n }\n \ndiff --git a/drivers/net/ethernet/intel/ice/ice_dcb.h b/drivers/net/ethernet/intel/ice/ice_dcb.h\nindex ee138f9bdc7c..d7e5e6178a21 100644\n--- a/drivers/net/ethernet/intel/ice/ice_dcb.h\n+++ b/drivers/net/ethernet/intel/ice/ice_dcb.h\n@@ -87,7 +87,7 @@\n struct ice_lldp_org_tlv {\n \t__be16 typelen;\n \t__be32 ouisubtype;\n-\tu8 tlvinfo[1];\n+\tu8 tlvinfo[];\n } __packed;\n \n struct ice_cee_tlv_hdr {\n@@ -109,7 +109,7 @@ struct ice_cee_feat_tlv {\n #define ICE_CEE_FEAT_TLV_WILLING_M\t0x40\n #define ICE_CEE_FEAT_TLV_ERR_M\t\t0x20\n \tu8 subtype;\n-\tu8 tlvinfo[1];\n+\tu8 tlvinfo[];\n };\n \n struct ice_cee_app_prio {\ndiff --git a/drivers/net/ethernet/intel/ice/ice_flex_pipe.c b/drivers/net/ethernet/intel/ice/ice_flex_pipe.c\nindex 4420fc02f7e7..3c217e51b27e 100644\n--- a/drivers/net/ethernet/intel/ice/ice_flex_pipe.c\n+++ b/drivers/net/ethernet/intel/ice/ice_flex_pipe.c\n@@ -1121,8 +1121,7 @@ static enum ice_status ice_get_pkg_info(struct ice_hw *hw)\n \tu16 size;\n \tu32 i;\n \n-\tsize = sizeof(*pkg_info) + (sizeof(pkg_info->pkg_info[0]) *\n-\t\t\t\t    (ICE_PKG_CNT - 1));\n+\tsize = struct_size(pkg_info, pkg_info, ICE_PKG_CNT);\n \tpkg_info = kzalloc(size, GFP_KERNEL);\n \tif (!pkg_info)\n \t\treturn ICE_ERR_NO_MEMORY;\n@@ -1180,7 +1179,7 @@ static enum ice_status ice_verify_pkg(struct ice_pkg_hdr *pkg, u32 len)\n \tu32 seg_count;\n \tu32 i;\n \n-\tif (len < sizeof(*pkg))\n+\tif (len < struct_size(pkg, seg_offset, 1))\n \t\treturn ICE_ERR_BUF_TOO_SHORT;\n \n \tif (pkg->pkg_format_ver.major != ICE_PKG_FMT_VER_MAJ ||\n@@ -1195,7 +1194,7 @@ static enum ice_status ice_verify_pkg(struct ice_pkg_hdr *pkg, u32 len)\n \t\treturn ICE_ERR_CFG;\n \n \t/* make sure segment array fits in package length */\n-\tif (len < sizeof(*pkg) + ((seg_count - 1) * sizeof(pkg->seg_offset)))\n+\tif (len < struct_size(pkg, seg_offset, seg_count))\n \t\treturn ICE_ERR_BUF_TOO_SHORT;\n \n \t/* all segments must fit within length */\n@@ -1300,7 +1299,7 @@ ice_chk_pkg_compat(struct ice_hw *hw, struct ice_pkg_hdr *ospkg,\n \t}\n \n \t/* Check if FW is compatible with the OS package */\n-\tsize = struct_size(pkg, pkg_info, ICE_PKG_CNT - 1);\n+\tsize = struct_size(pkg, pkg_info, ICE_PKG_CNT);\n \tpkg = kzalloc(size, GFP_KERNEL);\n \tif (!pkg)\n \t\treturn ICE_ERR_NO_MEMORY;\n@@ -1764,13 +1763,13 @@ ice_create_tunnel(struct ice_hw *hw, enum ice_tunnel_type type, u16 port)\n \t\tgoto ice_create_tunnel_err;\n \n \tsect_rx = ice_pkg_buf_alloc_section(bld, ICE_SID_RXPARSER_BOOST_TCAM,\n-\t\t\t\t\t    sizeof(*sect_rx));\n+\t\t\t\t\t    struct_size(sect_rx, tcam, 1));\n \tif (!sect_rx)\n \t\tgoto ice_create_tunnel_err;\n \tsect_rx->count = cpu_to_le16(1);\n \n \tsect_tx = ice_pkg_buf_alloc_section(bld, ICE_SID_TXPARSER_BOOST_TCAM,\n-\t\t\t\t\t    sizeof(*sect_tx));\n+\t\t\t\t\t    struct_size(sect_tx, tcam, 1));\n \tif (!sect_tx)\n \t\tgoto ice_create_tunnel_err;\n \tsect_tx->count = cpu_to_le16(1);\n@@ -1847,7 +1846,7 @@ enum ice_status ice_destroy_tunnel(struct ice_hw *hw, u16 port, bool all)\n \t}\n \n \t/* size of section - there is at least one entry */\n-\tsize = struct_size(sect_rx, tcam, count - 1);\n+\tsize = struct_size(sect_rx, tcam, count);\n \n \tbld = ice_pkg_buf_alloc(hw);\n \tif (!bld) {\n@@ -3324,10 +3323,10 @@ ice_prof_bld_es(struct ice_hw *hw, enum ice_block blk,\n \t\t\tu32 id;\n \n \t\t\tid = ice_sect_id(blk, ICE_VEC_TBL);\n-\t\t\tp = (struct ice_pkg_es *)\n-\t\t\t\tice_pkg_buf_alloc_section(bld, id, sizeof(*p) +\n-\t\t\t\t\t\t\t  vec_size -\n-\t\t\t\t\t\t\t  sizeof(p->es[0]));\n+\t\t\tp = ice_pkg_buf_alloc_section(bld, id,\n+\t\t\t\t\t\t      struct_size(p, es, 1) +\n+\t\t\t\t\t\t      vec_size -\n+\t\t\t\t\t\t      sizeof(p->es[0]));\n \n \t\t\tif (!p)\n \t\t\t\treturn ICE_ERR_MAX_LIMIT;\n@@ -3360,8 +3359,8 @@ ice_prof_bld_tcam(struct ice_hw *hw, enum ice_block blk,\n \t\t\tu32 id;\n \n \t\t\tid = ice_sect_id(blk, ICE_PROF_TCAM);\n-\t\t\tp = (struct ice_prof_id_section *)\n-\t\t\t\tice_pkg_buf_alloc_section(bld, id, sizeof(*p));\n+\t\t\tp = ice_pkg_buf_alloc_section(bld, id,\n+\t\t\t\t\t\t      struct_size(p, entry, 1));\n \n \t\t\tif (!p)\n \t\t\t\treturn ICE_ERR_MAX_LIMIT;\n@@ -3396,8 +3395,8 @@ ice_prof_bld_xlt1(enum ice_block blk, struct ice_buf_build *bld,\n \t\t\tu32 id;\n \n \t\t\tid = ice_sect_id(blk, ICE_XLT1);\n-\t\t\tp = (struct ice_xlt1_section *)\n-\t\t\t\tice_pkg_buf_alloc_section(bld, id, sizeof(*p));\n+\t\t\tp = ice_pkg_buf_alloc_section(bld, id,\n+\t\t\t\t\t\t      struct_size(p, value, 1));\n \n \t\t\tif (!p)\n \t\t\t\treturn ICE_ERR_MAX_LIMIT;\n@@ -3431,8 +3430,8 @@ ice_prof_bld_xlt2(enum ice_block blk, struct ice_buf_build *bld,\n \t\tcase ICE_VSI_MOVE:\n \t\tcase ICE_VSIG_REM:\n \t\t\tid = ice_sect_id(blk, ICE_XLT2);\n-\t\t\tp = (struct ice_xlt2_section *)\n-\t\t\t\tice_pkg_buf_alloc_section(bld, id, sizeof(*p));\n+\t\t\tp = ice_pkg_buf_alloc_section(bld, id,\n+\t\t\t\t\t\t      struct_size(p, value, 1));\n \n \t\t\tif (!p)\n \t\t\t\treturn ICE_ERR_MAX_LIMIT;\ndiff --git a/drivers/net/ethernet/intel/ice/ice_flex_type.h b/drivers/net/ethernet/intel/ice/ice_flex_type.h\nindex a6f391eac8ff..c1c99a267a98 100644\n--- a/drivers/net/ethernet/intel/ice/ice_flex_type.h\n+++ b/drivers/net/ethernet/intel/ice/ice_flex_type.h\n@@ -22,7 +22,7 @@ struct ice_fv {\n struct ice_pkg_hdr {\n \tstruct ice_pkg_ver pkg_format_ver;\n \t__le32 seg_count;\n-\t__le32 seg_offset[1];\n+\t__le32 seg_offset[];\n };\n \n /* generic segment */\n@@ -53,12 +53,12 @@ struct ice_device_id_entry {\n struct ice_seg {\n \tstruct ice_generic_seg_hdr hdr;\n \t__le32 device_table_count;\n-\tstruct ice_device_id_entry device_table[1];\n+\tstruct ice_device_id_entry device_table[];\n };\n \n struct ice_nvm_table {\n \t__le32 table_count;\n-\t__le32 vers[1];\n+\t__le32 vers[];\n };\n \n struct ice_buf {\n@@ -68,7 +68,7 @@ struct ice_buf {\n \n struct ice_buf_table {\n \t__le32 buf_count;\n-\tstruct ice_buf buf_array[1];\n+\tstruct ice_buf buf_array[];\n };\n \n /* global metadata specific segment */\n@@ -101,11 +101,12 @@ struct ice_section_entry {\n struct ice_buf_hdr {\n \t__le16 section_count;\n \t__le16 data_end;\n-\tstruct ice_section_entry section_entry[1];\n+\tstruct ice_section_entry section_entry[];\n };\n \n #define ICE_MAX_ENTRIES_IN_BUF(hd_sz, ent_sz) ((ICE_PKG_BUF_SIZE - \\\n-\tsizeof(struct ice_buf_hdr) - (hd_sz)) / (ent_sz))\n+\tstruct_size((struct ice_buf_hdr *)0, section_entry, 1) - (hd_sz)) /\\\n+\t(ent_sz))\n \n /* ice package section IDs */\n #define ICE_SID_XLT0_SW\t\t\t10\n@@ -198,17 +199,17 @@ struct ice_label {\n \n struct ice_label_section {\n \t__le16 count;\n-\tstruct ice_label label[1];\n+\tstruct ice_label label[];\n };\n \n #define ICE_MAX_LABELS_IN_BUF ICE_MAX_ENTRIES_IN_BUF( \\\n-\tsizeof(struct ice_label_section) - sizeof(struct ice_label), \\\n-\tsizeof(struct ice_label))\n+\tstruct_size((struct ice_label_section *)0, label, 1) - \\\n+\tsizeof(struct ice_label), sizeof(struct ice_label))\n \n struct ice_sw_fv_section {\n \t__le16 count;\n \t__le16 base_offset;\n-\tstruct ice_fv fv[1];\n+\tstruct ice_fv fv[];\n };\n \n /* The BOOST TCAM stores the match packet header in reverse order, meaning\n@@ -245,30 +246,30 @@ struct ice_boost_tcam_entry {\n struct ice_boost_tcam_section {\n \t__le16 count;\n \t__le16 reserved;\n-\tstruct ice_boost_tcam_entry tcam[1];\n+\tstruct ice_boost_tcam_entry tcam[];\n };\n \n #define ICE_MAX_BST_TCAMS_IN_BUF ICE_MAX_ENTRIES_IN_BUF( \\\n-\tsizeof(struct ice_boost_tcam_section) - \\\n+\tstruct_size((struct ice_boost_tcam_section *)0, tcam, 1) - \\\n \tsizeof(struct ice_boost_tcam_entry), \\\n \tsizeof(struct ice_boost_tcam_entry))\n \n struct ice_xlt1_section {\n \t__le16 count;\n \t__le16 offset;\n-\tu8 value[1];\n-} __packed;\n+\tu8 value[];\n+};\n \n struct ice_xlt2_section {\n \t__le16 count;\n \t__le16 offset;\n-\t__le16 value[1];\n+\t__le16 value[];\n };\n \n struct ice_prof_redir_section {\n \t__le16 count;\n \t__le16 offset;\n-\tu8 redir_value[1];\n+\tu8 redir_value[];\n };\n \n /* package buffer building */\n@@ -327,7 +328,7 @@ struct ice_tunnel_table {\n struct ice_pkg_es {\n \t__le16 count;\n \t__le16 offset;\n-\tstruct ice_fv_word es[1];\n+\tstruct ice_fv_word es[];\n };\n \n struct ice_es {\n@@ -461,8 +462,8 @@ struct ice_prof_tcam_entry {\n \n struct ice_prof_id_section {\n \t__le16 count;\n-\tstruct ice_prof_tcam_entry entry[1];\n-} __packed;\n+\tstruct ice_prof_tcam_entry entry[];\n+};\n \n struct ice_prof_tcam {\n \tu32 sid;\ndiff --git a/drivers/net/ethernet/intel/ice/ice_lib.c b/drivers/net/ethernet/intel/ice/ice_lib.c\nindex 2e3a39cea2c0..8a4c7b8b95df 100644\n--- a/drivers/net/ethernet/intel/ice/ice_lib.c\n+++ b/drivers/net/ethernet/intel/ice/ice_lib.c\n@@ -1667,7 +1667,7 @@ ice_vsi_cfg_txqs(struct ice_vsi *vsi, struct ice_ring **rings)\n \tu16 q_idx = 0;\n \tint err = 0;\n \n-\tqg_buf = kzalloc(sizeof(*qg_buf), GFP_KERNEL);\n+\tqg_buf = kzalloc(struct_size(qg_buf, txqs, 1), GFP_KERNEL);\n \tif (!qg_buf)\n \t\treturn -ENOMEM;\n \ndiff --git a/drivers/net/ethernet/intel/ice/ice_sched.c b/drivers/net/ethernet/intel/ice/ice_sched.c\nindex 294257b4d138..1c29cfa1cf33 100644\n--- a/drivers/net/ethernet/intel/ice/ice_sched.c\n+++ b/drivers/net/ethernet/intel/ice/ice_sched.c\n@@ -238,7 +238,7 @@ ice_sched_remove_elems(struct ice_hw *hw, struct ice_sched_node *parent,\n \tenum ice_status status;\n \tu16 buf_size;\n \n-\tbuf_size = sizeof(*buf) + sizeof(u32) * (num_nodes - 1);\n+\tbuf_size = struct_size(buf, teid, num_nodes);\n \tbuf = devm_kzalloc(ice_hw_to_dev(hw), buf_size, GFP_KERNEL);\n \tif (!buf)\n \t\treturn ICE_ERR_NO_MEMORY;\n@@ -825,7 +825,7 @@ ice_sched_add_elems(struct ice_port_info *pi, struct ice_sched_node *tc_node,\n \tsize_t buf_size;\n \tu32 teid;\n \n-\tbuf_size = struct_size(buf, generic, num_nodes - 1);\n+\tbuf_size = struct_size(buf, generic, num_nodes);\n \tbuf = devm_kzalloc(ice_hw_to_dev(hw), buf_size, GFP_KERNEL);\n \tif (!buf)\n \t\treturn ICE_ERR_NO_MEMORY;\ndiff --git a/drivers/net/ethernet/intel/ice/ice_switch.c b/drivers/net/ethernet/intel/ice/ice_switch.c\nindex 0414be3f47dd..ccbe1cc64295 100644\n--- a/drivers/net/ethernet/intel/ice/ice_switch.c\n+++ b/drivers/net/ethernet/intel/ice/ice_switch.c\n@@ -29,25 +29,17 @@ static const u8 dummy_eth_header[DUMMY_ETH_HDR_LEN] = { 0x2, 0, 0, 0, 0, 0,\n \t\t\t\t\t\t\t0x81, 0, 0, 0};\n \n #define ICE_SW_RULE_RX_TX_ETH_HDR_SIZE \\\n-\t(sizeof(struct ice_aqc_sw_rules_elem) - \\\n-\t sizeof(((struct ice_aqc_sw_rules_elem *)0)->pdata) + \\\n-\t sizeof(struct ice_sw_rule_lkup_rx_tx) + DUMMY_ETH_HDR_LEN - 1)\n+\t(offsetof(struct ice_aqc_sw_rules_elem, pdata.lkup_tx_rx.hdr) + \\\n+\t (DUMMY_ETH_HDR_LEN * \\\n+\t  sizeof(((struct ice_sw_rule_lkup_rx_tx *)0)->hdr[0])))\n #define ICE_SW_RULE_RX_TX_NO_HDR_SIZE \\\n-\t(sizeof(struct ice_aqc_sw_rules_elem) - \\\n-\t sizeof(((struct ice_aqc_sw_rules_elem *)0)->pdata) + \\\n-\t sizeof(struct ice_sw_rule_lkup_rx_tx) - 1)\n+\t(offsetof(struct ice_aqc_sw_rules_elem, pdata.lkup_tx_rx.hdr))\n #define ICE_SW_RULE_LG_ACT_SIZE(n) \\\n-\t(sizeof(struct ice_aqc_sw_rules_elem) - \\\n-\t sizeof(((struct ice_aqc_sw_rules_elem *)0)->pdata) + \\\n-\t sizeof(struct ice_sw_rule_lg_act) - \\\n-\t sizeof(((struct ice_sw_rule_lg_act *)0)->act) + \\\n-\t ((n) * sizeof(((struct ice_sw_rule_lg_act *)0)->act)))\n+\t(offsetof(struct ice_aqc_sw_rules_elem, pdata.lg_act.act) + \\\n+\t ((n) * sizeof(((struct ice_sw_rule_lg_act *)0)->act[0])))\n #define ICE_SW_RULE_VSI_LIST_SIZE(n) \\\n-\t(sizeof(struct ice_aqc_sw_rules_elem) - \\\n-\t sizeof(((struct ice_aqc_sw_rules_elem *)0)->pdata) + \\\n-\t sizeof(struct ice_sw_rule_vsi_list) - \\\n-\t sizeof(((struct ice_sw_rule_vsi_list *)0)->vsi) + \\\n-\t ((n) * sizeof(((struct ice_sw_rule_vsi_list *)0)->vsi)))\n+\t(offsetof(struct ice_aqc_sw_rules_elem, pdata.vsi_list.vsi) + \\\n+\t ((n) * sizeof(((struct ice_sw_rule_vsi_list *)0)->vsi[0])))\n \n /**\n  * ice_init_def_sw_recp - initialize the recipe book keeping tables\n@@ -449,7 +441,7 @@ ice_aq_alloc_free_vsi_list(struct ice_hw *hw, u16 *vsi_list_id,\n \tenum ice_status status;\n \tu16 buf_len;\n \n-\tbuf_len = sizeof(*sw_buf);\n+\tbuf_len = struct_size(sw_buf, elem, 1);\n \tsw_buf = devm_kzalloc(ice_hw_to_dev(hw), buf_len, GFP_KERNEL);\n \tif (!sw_buf)\n \t\treturn ICE_ERR_NO_MEMORY;\n@@ -856,8 +848,7 @@ ice_add_marker_act(struct ice_hw *hw, struct ice_fltr_mgmt_list_entry *m_ent,\n \t\tm_ent->fltr_info.fwd_id.hw_vsi_id;\n \n \tact = ICE_LG_ACT_VSI_FORWARDING | ICE_LG_ACT_VALID_BIT;\n-\tact |= (id << ICE_LG_ACT_VSI_LIST_ID_S) &\n-\t\tICE_LG_ACT_VSI_LIST_ID_M;\n+\tact |= (id << ICE_LG_ACT_VSI_LIST_ID_S) & ICE_LG_ACT_VSI_LIST_ID_M;\n \tif (m_ent->vsi_count > 1)\n \t\tact |= ICE_LG_ACT_VSI_LIST;\n \tlg_act->pdata.lg_act.act[0] = cpu_to_le32(act);\n@@ -2037,7 +2028,8 @@ ice_cfg_dflt_vsi(struct ice_hw *hw, u16 vsi_handle, bool set, u8 direction)\n \thw_vsi_id = ice_get_hw_vsi_num(hw, vsi_handle);\n \n \ts_rule_size = set ? ICE_SW_RULE_RX_TX_ETH_HDR_SIZE :\n-\t\t\t    ICE_SW_RULE_RX_TX_NO_HDR_SIZE;\n+\t\tICE_SW_RULE_RX_TX_NO_HDR_SIZE;\n+\n \ts_rule = devm_kzalloc(ice_hw_to_dev(hw), s_rule_size, GFP_KERNEL);\n \tif (!s_rule)\n \t\treturn ICE_ERR_NO_MEMORY;\n@@ -2691,7 +2683,7 @@ ice_alloc_res_cntr(struct ice_hw *hw, u8 type, u8 alloc_shared, u16 num_items,\n \tu16 buf_len;\n \n \t/* Allocate resource */\n-\tbuf_len = sizeof(*buf);\n+\tbuf_len = struct_size(buf, elem, 1);\n \tbuf = kzalloc(buf_len, GFP_KERNEL);\n \tif (!buf)\n \t\treturn ICE_ERR_NO_MEMORY;\n@@ -2729,7 +2721,7 @@ ice_free_res_cntr(struct ice_hw *hw, u8 type, u8 alloc_shared, u16 num_items,\n \tu16 buf_len;\n \n \t/* Free resource */\n-\tbuf_len = sizeof(*buf);\n+\tbuf_len = struct_size(buf, elem, 1);\n \tbuf = kzalloc(buf_len, GFP_KERNEL);\n \tif (!buf)\n \t\treturn ICE_ERR_NO_MEMORY;\ndiff --git a/drivers/net/ethernet/intel/ice/ice_xsk.c b/drivers/net/ethernet/intel/ice/ice_xsk.c\nindex b6f928c9e9c9..6badfd62dc63 100644\n--- a/drivers/net/ethernet/intel/ice/ice_xsk.c\n+++ b/drivers/net/ethernet/intel/ice/ice_xsk.c\n@@ -206,12 +206,14 @@ static int ice_qp_ena(struct ice_vsi *vsi, u16 q_idx)\n \tstruct ice_aqc_add_tx_qgrp *qg_buf;\n \tstruct ice_ring *tx_ring, *rx_ring;\n \tstruct ice_q_vector *q_vector;\n+\tu16 size;\n \tint err;\n \n \tif (q_idx >= vsi->num_rxq || q_idx >= vsi->num_txq)\n \t\treturn -EINVAL;\n \n-\tqg_buf = kzalloc(sizeof(*qg_buf), GFP_KERNEL);\n+\tsize = struct_size(qg_buf, txqs, 1);\n+\tqg_buf = kzalloc(size, GFP_KERNEL);\n \tif (!qg_buf)\n \t\treturn -ENOMEM;\n \n@@ -228,7 +230,7 @@ static int ice_qp_ena(struct ice_vsi *vsi, u16 q_idx)\n \tif (ice_is_xdp_ena_vsi(vsi)) {\n \t\tstruct ice_ring *xdp_ring = vsi->xdp_rings[q_idx];\n \n-\t\tmemset(qg_buf, 0, sizeof(*qg_buf));\n+\t\tmemset(qg_buf, 0, size);\n \t\tqg_buf->num_txqs = 1;\n \t\terr = ice_vsi_cfg_txq(vsi, xdp_ring, qg_buf);\n \t\tif (err)\n",
    "prefixes": [
        "2/2"
    ]
}