From nobody Fri Feb 6 17:59:27 2026 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4f720b3JR7z6RVpW for ; Fri, 06 Feb 2026 17:59:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R13" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4f720b2MsVz4KS9 for ; Fri, 06 Feb 2026 17:59:27 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1770400767; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=tZwzTrqRRGuWVP5hsKs723uUsW8n4Zu49pdwR0cjMGA=; b=D2wef+5HEGptNgt0lgtYVAtE1sSx5jjgJwLq8Owg82AeinhreIwwy+arI9FceqNA6MFZPv lHoAPu7u2fIjiXuR7szJp+xacwzWaZYIWpPJEGjDYi5UwNhzTCfwfaRUQOOyWQDmXbpRLA NoV9Y61VslpMtUCxpKs2e/A4KAOOgjX+k2SGs1kt46H2jD/VhjxJ3eqZSkcX+vygOeslgS SkL8KTGhDZEAxjDx3KvYJrZbjBjw2ikJjdwrT9PakG1weKSERCCZXezuOza1SHmuGIQyfA FyD/JgE0k1vUpt4PuP+BQ5Fdxh9l0Iuo420O9CH6WV19FV+eoL4vn7+xEAgIPQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1770400767; a=rsa-sha256; cv=none; b=g9HqfAKJNDzh68SVJhXnNRk/I7eKnA7XkQYuVfss83tbyNvNaNbfxFjvSirjcau4wLj79y NbCO10wmHKfDwDjH/3PiJMBPpoZoUttYoDrK2Ra3cKYrhEykFyhtLZWZ6TffgCdB91PCZE gyQOR192D1U7irinGYdCbYIACdfMHkieNzlZmo0/ADqsepAbJZn3D4ZI0ta/Dm3YQb9uUH qdRTuXC1JcaEeStUKQbvwbJc6o1jGVOHSmKxini/xNAXiWjQe0FytuvNv/JjGVtH2LRzVS MgPagF6jxx9By6TJyEefozCqhaLHmt5l399YOi5VBOu1qhNouveBHkIUT+6QoA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1770400767; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=tZwzTrqRRGuWVP5hsKs723uUsW8n4Zu49pdwR0cjMGA=; b=ZEatKs+kQkWQs5almcKOjL6Y5fwSMQiUF/FA+lW7MKi3vsy1SpORUkddPDx6BKR6kuhbZs kmuS6Npcb92cbEnF9mAH6ECvq6/SMBhWTFrxdVPWYzhJDtr+c309Sq8uL6EKEqL6F7qKDf RP1A8G7EbL2FH5pF4Dfbele0xtlktbFzukrf6p4mdCwa3ad2RevfL+eaa3BzxGa0Fcr+Ci sxibE6eQpR8LEHSBE99QzIPYEWRccu61CzKkQUX5ynHKPClcDjFq3tUQfQmwUwQnU0SQnr ++5e027wTPuwNWCe7r44m1Edz1gUVOOEubp2V9llvoz/mvTXlyZ0FF578UuRXw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4f720b1sHhz9Qn for ; Fri, 06 Feb 2026 17:59:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 30127 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 06 Feb 2026 17:59:27 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Zhenlei Huang Subject: git: 3aeeedc7e0dc - main - qlnxe: Avoid memcpy with same source and destination List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: zlei X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3aeeedc7e0dc231c16406ff64f4a08a716964c40 Auto-Submitted: auto-generated Date: Fri, 06 Feb 2026 17:59:27 +0000 Message-Id: <69862bff.30127.8f264c6@gitrepo.freebsd.org> The branch main has been updated by zlei: URL: https://cgit.FreeBSD.org/src/commit/?id=3aeeedc7e0dc231c16406ff64f4a08a716964c40 commit 3aeeedc7e0dc231c16406ff64f4a08a716964c40 Author: Zhenlei Huang AuthorDate: 2026-02-06 17:52:53 +0000 Commit: Zhenlei Huang CommitDate: 2026-02-06 17:52:53 +0000 qlnxe: Avoid memcpy with same source and destination In case the device is VF, qlnx_get_mac_addr() returns ha->primary_mac hence it ends up memcpy with same source and destination. Refactor slightly to avoid that. Reviewed by: kbowling MFC after: 5 days Differential Revision: https://reviews.freebsd.org/D54884 --- sys/dev/qlnx/qlnxe/qlnx_def.h | 1 - sys/dev/qlnx/qlnxe/qlnx_os.c | 13 +++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/sys/dev/qlnx/qlnxe/qlnx_def.h b/sys/dev/qlnx/qlnxe/qlnx_def.h index 796845f3f8c6..ed3a0403bb6f 100644 --- a/sys/dev/qlnx/qlnxe/qlnx_def.h +++ b/sys/dev/qlnx/qlnxe/qlnx_def.h @@ -683,7 +683,6 @@ extern int qlnx_grc_dump(qlnx_host_t *ha, uint32_t *num_dumped_dwords, int hwfn_index); extern int qlnx_idle_chk(qlnx_host_t *ha, uint32_t *num_dumped_dwords, int hwfn_index); -extern uint8_t *qlnx_get_mac_addr(qlnx_host_t *ha); extern void qlnx_fill_link(qlnx_host_t *ha, struct ecore_hwfn *hwfn, struct qlnx_link_output *if_link); extern int qlnx_set_lldp_tlvx(qlnx_host_t *ha, qlnx_lldp_sys_tlvs_t *lldp_tlvs); diff --git a/sys/dev/qlnx/qlnxe/qlnx_os.c b/sys/dev/qlnx/qlnxe/qlnx_os.c index 9616d9f4d611..1c885133c3ec 100644 --- a/sys/dev/qlnx/qlnxe/qlnx_os.c +++ b/sys/dev/qlnx/qlnxe/qlnx_os.c @@ -101,6 +101,7 @@ static void qlnx_stop(qlnx_host_t *ha); static int qlnx_send(qlnx_host_t *ha, struct qlnx_fastpath *fp, struct mbuf **m_headp); static int qlnx_get_ifq_snd_maxlen(qlnx_host_t *ha); +static void qlnx_get_mac_addr(qlnx_host_t *ha); static uint32_t qlnx_get_optics(qlnx_host_t *ha, struct qlnx_link_output *if_link); static int qlnx_transmit(if_t ifp, struct mbuf *mp); @@ -2322,7 +2323,7 @@ qlnx_init_ifnet(device_t dev, qlnx_host_t *ha) ha->max_frame_size = if_getmtu(ifp) + ETHER_HDR_LEN + ETHER_CRC_LEN; - memcpy(ha->primary_mac, qlnx_get_mac_addr(ha), ETH_ALEN); + qlnx_get_mac_addr(ha); if (!ha->primary_mac[0] && !ha->primary_mac[1] && !ha->primary_mac[2] && !ha->primary_mac[3] && @@ -3772,7 +3773,7 @@ qlnx_get_ifq_snd_maxlen(qlnx_host_t *ha) return(TX_RING_SIZE - 1); } -uint8_t * +static void qlnx_get_mac_addr(qlnx_host_t *ha) { struct ecore_hwfn *p_hwfn; @@ -3781,8 +3782,10 @@ qlnx_get_mac_addr(qlnx_host_t *ha) p_hwfn = &ha->cdev.hwfns[0]; - if (qlnx_vf_device(ha) != 0) - return (p_hwfn->hw_info.hw_mac_addr); + if (qlnx_vf_device(ha) != 0) { + memcpy(ha->primary_mac, p_hwfn->hw_info.hw_mac_addr, ETH_ALEN); + return; + } ecore_vf_read_bulletin(p_hwfn, &p_is_forced); if (ecore_vf_bulletin_get_forced_mac(p_hwfn, mac, &p_is_forced) == @@ -3792,8 +3795,6 @@ qlnx_get_mac_addr(qlnx_host_t *ha) p_is_forced, mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); memcpy(ha->primary_mac, mac, ETH_ALEN); } - - return (ha->primary_mac); } static uint32_t