From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 8FC8543829 for ; Fri, 8 Mar 2024 15:32:03 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8765C43373; Fri, 8 Mar 2024 15:32:03 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id 4F12A40E2D for ; Fri, 8 Mar 2024 15:32:01 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1709908320; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+wHX/hcg/oI5p9MRVNCAe3GmdJsKHChwgCuJXCPIQHg=; b=hws5WPWrcas6VVv7wykWWSOgA9YucpBBovkpOYjYWlWB4icDWwW6l5hNMyym3xEYJPxueI wti5LNpPeMO1keM5U4Xv9+tGo2LOHo+jmfJ6PyE5imyW4zKKnMoczpONDF7KFmKfeD0QgZ GPUt8lQna/+m042QQZ1zmXCY0E3RSyQ= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-428-n3Pj7dF6Npywq-spqL1c0A-1; Fri, 08 Mar 2024 09:31:59 -0500 X-MC-Unique: n3Pj7dF6Npywq-spqL1c0A-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2919F80026C; Fri, 8 Mar 2024 14:31:59 +0000 (UTC) Received: from rh.redhat.com (unknown [10.39.194.94]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7F16937FC; Fri, 8 Mar 2024 14:31:58 +0000 (UTC) From: Kevin Traynor To: =?UTF-8?q?Morten=20Br=C3=B8rup?= Cc: Devendra Singh Rawat , dpdk stable Subject: patch 'net/bnx2x: fix warnings about memcpy lengths' has been queued to stable release 21.11.7 Date: Fri, 8 Mar 2024 14:28:06 +0000 Message-ID: <20240308142824.528417-18-ktraynor@redhat.com> In-Reply-To: <20240308142824.528417-1-ktraynor@redhat.com> References: <20240308142824.528417-1-ktraynor@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Hi, FYI, your patch has been queued to stable release 21.11.7 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 03/13/24. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/kevintraynor/dpdk-stable This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable/commit/61ced40b0df4de1ad74b0ebb33387a781c87b44b Thanks. Kevin --- >From 61ced40b0df4de1ad74b0ebb33387a781c87b44b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Br=C3=B8rup?= Date: Fri, 23 Feb 2024 15:00:56 +0100 Subject: [PATCH] net/bnx2x: fix warnings about memcpy lengths MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [ upstream commit c50b86f7d60f757ea62fe14076be69bf114f1740 ] The vlan in the bulletin does not contain a VLAN header, only the VLAN ID, so only copy 2 byte, not 4. The target structure has padding after the field, so copying 2 byte too many is effectively harmless. Fix it by using generic memcpy version instead of specialized rte version as it not used in fast path. Also, Use RTE_PTR_ADD where copying arrays to the offset of a first field in a structure holding multiple fields, to avoid compiler warnings with decorated memcpy. Bugzilla ID: 1146 Fixes: 540a211084a7 ("bnx2x: driver core") Signed-off-by: Morten Brørup Acked-by: Devendra Singh Rawat --- drivers/net/bnx2x/bnx2x_stats.c | 14 ++++++++------ drivers/net/bnx2x/bnx2x_vfpf.c | 14 +++++++------- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/drivers/net/bnx2x/bnx2x_stats.c b/drivers/net/bnx2x/bnx2x_stats.c index c07b01510a..69132c7c80 100644 --- a/drivers/net/bnx2x/bnx2x_stats.c +++ b/drivers/net/bnx2x/bnx2x_stats.c @@ -115,5 +115,5 @@ bnx2x_hw_stats_post(struct bnx2x_softc *sc) /* Update MCP's statistics if possible */ if (sc->func_stx) { - rte_memcpy(BNX2X_SP(sc, func_stats), &sc->func_stats, + memcpy(BNX2X_SP(sc, func_stats), &sc->func_stats, sizeof(sc->func_stats)); } @@ -818,8 +818,8 @@ bnx2x_hw_stats_update(struct bnx2x_softc *sc) } - rte_memcpy(old, new, sizeof(struct nig_stats)); + memcpy(old, new, sizeof(struct nig_stats)); - rte_memcpy(&(estats->rx_stat_ifhcinbadoctets_hi), &(pstats->mac_stx[1]), - sizeof(struct mac_stx)); + memcpy(RTE_PTR_ADD(estats, offsetof(struct bnx2x_eth_stats, rx_stat_ifhcinbadoctets_hi)), + &pstats->mac_stx[1], sizeof(struct mac_stx)); estats->brb_drop_hi = pstats->brb_drop_hi; estats->brb_drop_lo = pstats->brb_drop_lo; @@ -1493,7 +1493,9 @@ bnx2x_stats_init(struct bnx2x_softc *sc) if (!CHIP_IS_E3(sc)) { REG_RD_DMAE(sc, NIG_REG_STAT0_EGRESS_MAC_PKT0 + port*0x50, - &(sc->port.old_nig_stats.egress_mac_pkt0_lo), 2); + RTE_PTR_ADD(&sc->port.old_nig_stats, + offsetof(struct nig_stats, egress_mac_pkt0_lo)), 2); REG_RD_DMAE(sc, NIG_REG_STAT0_EGRESS_MAC_PKT1 + port*0x50, - &(sc->port.old_nig_stats.egress_mac_pkt1_lo), 2); + RTE_PTR_ADD(&sc->port.old_nig_stats, + offsetof(struct nig_stats, egress_mac_pkt1_lo)), 2); } diff --git a/drivers/net/bnx2x/bnx2x_vfpf.c b/drivers/net/bnx2x/bnx2x_vfpf.c index 63953c2979..5411df3a38 100644 --- a/drivers/net/bnx2x/bnx2x_vfpf.c +++ b/drivers/net/bnx2x/bnx2x_vfpf.c @@ -53,7 +53,7 @@ bnx2x_check_bull(struct bnx2x_softc *sc) /* check the mac address and VLAN and allocate memory if valid */ if (valid_bitmap & (1 << MAC_ADDR_VALID) && memcmp(bull->mac, sc->old_bulletin.mac, ETH_ALEN)) - rte_memcpy(&sc->link_params.mac_addr, bull->mac, ETH_ALEN); + memcpy(&sc->link_params.mac_addr, bull->mac, ETH_ALEN); if (valid_bitmap & (1 << VLAN_VALID)) - rte_memcpy(&bull->vlan, &sc->old_bulletin.vlan, RTE_VLAN_HLEN); + memcpy(&bull->vlan, &sc->old_bulletin.vlan, sizeof(bull->vlan)); sc->old_bulletin = *bull; @@ -570,5 +570,5 @@ bnx2x_vf_set_mac(struct bnx2x_softc *sc, int set) bnx2x_check_bull(sc); - rte_memcpy(query->filters[0].mac, sc->link_params.mac_addr, ETH_ALEN); + memcpy(query->filters[0].mac, sc->link_params.mac_addr, ETH_ALEN); bnx2x_add_tlv(sc, query, query->first_tlv.tl.length, @@ -584,7 +584,7 @@ bnx2x_vf_set_mac(struct bnx2x_softc *sc, int set) bnx2x_check_bull(sc)) { /* A new mac was configured by PF for us */ - rte_memcpy(sc->link_params.mac_addr, sc->pf2vf_bulletin->mac, + memcpy(sc->link_params.mac_addr, sc->pf2vf_bulletin->mac, ETH_ALEN); - rte_memcpy(query->filters[0].mac, sc->pf2vf_bulletin->mac, + memcpy(query->filters[0].mac, sc->pf2vf_bulletin->mac, ETH_ALEN); @@ -623,8 +623,8 @@ bnx2x_vf_config_rss(struct bnx2x_softc *sc, sizeof(struct channel_list_end_tlv)); - rte_memcpy(query->rss_key, params->rss_key, sizeof(params->rss_key)); + memcpy(query->rss_key, params->rss_key, sizeof(params->rss_key)); query->rss_key_size = T_ETH_RSS_KEY; - rte_memcpy(query->ind_table, params->ind_table, T_ETH_INDIRECTION_TABLE_SIZE); + memcpy(query->ind_table, params->ind_table, T_ETH_INDIRECTION_TABLE_SIZE); query->ind_table_size = T_ETH_INDIRECTION_TABLE_SIZE; -- 2.43.2 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2024-03-08 13:47:49.577654766 +0000 +++ 0018-net-bnx2x-fix-warnings-about-memcpy-lengths.patch 2024-03-08 13:47:49.015686654 +0000 @@ -1 +1 @@ -From c50b86f7d60f757ea62fe14076be69bf114f1740 Mon Sep 17 00:00:00 2001 +From 61ced40b0df4de1ad74b0ebb33387a781c87b44b Mon Sep 17 00:00:00 2001 @@ -8,0 +9,2 @@ +[ upstream commit c50b86f7d60f757ea62fe14076be69bf114f1740 ] + @@ -21 +22,0 @@ -Cc: stable@dpdk.org