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 B06F342826 for ; Thu, 23 Mar 2023 18:01:57 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id ABE95427E9; Thu, 23 Mar 2023 18:01:57 +0100 (CET) Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by mails.dpdk.org (Postfix) with ESMTP id AE4864021E; Thu, 23 Mar 2023 18:01:54 +0100 (CET) Received: from pps.filterd (m0098416.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 32NFdlcB006203; Thu, 23 Mar 2023 17:01:54 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=CVyGjikuhpyv6sAz/uaHSMps1HrY7GXaGaLszM52crI=; b=mNxthPRy+o3tJQpST2l3yauEdPkqKElhAMYelRL1P2JUXs5VwJZap+6UhRYcc2g0k4ki YD+9OEApuByB6Q37naVYVzEFcobrEF30xVoukCdpkvyNA5OxTeIloov+K8rVGvmwFqqC RqtJxSkgN+9MsdufPafJytns5yog+jrv/+14Kdb0cLSWAmXA5NDjYhSfcj0W3rDVPxNV ajOT1r+/GAuQr0jsUK4SLhzKBJ+qP7/lPC0NOqs6WZHOEYsyYmyMNv9BUNE4jranOqwq +Ypd7tbhT+Ge+XrUoKPVjVUdESlhWgedSr340D7O3gY3ULhU3A3iLYVNqPlniTal5E38 Nw== Received: from ppma02dal.us.ibm.com (a.bd.3ea9.ip4.static.sl-reverse.com [169.62.189.10]) by mx0b-001b2d01.pphosted.com (PPS) with ESMTPS id 3pgkxv3tay-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 23 Mar 2023 17:01:53 +0000 Received: from pps.filterd (ppma02dal.us.ibm.com [127.0.0.1]) by ppma02dal.us.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 32NEtFX5030684; Thu, 23 Mar 2023 17:01:52 GMT Received: from smtprelay05.wdc07v.mail.ibm.com ([9.208.129.117]) by ppma02dal.us.ibm.com (PPS) with ESMTPS id 3pd4x7xp9j-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 23 Mar 2023 17:01:52 +0000 Received: from smtpav01.wdc07v.mail.ibm.com (smtpav01.wdc07v.mail.ibm.com [10.39.53.228]) by smtprelay05.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 32NH1pQe6357722 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 23 Mar 2023 17:01:51 GMT Received: from smtpav01.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id DCB9158055; Thu, 23 Mar 2023 17:01:50 +0000 (GMT) Received: from smtpav01.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 62E415804B; Thu, 23 Mar 2023 17:01:50 +0000 (GMT) Received: from ltc19u30.pok.stglabs.ibm.com (unknown [9.114.224.51]) by smtpav01.wdc07v.mail.ibm.com (Postfix) with ESMTP; Thu, 23 Mar 2023 17:01:50 +0000 (GMT) From: David Christensen To: dev@dpdk.org, stephen@networkplumber.org Cc: David Christensen , stable@dpdk.org Subject: [PATCH v2] net/tap: resolve stringop-overflow with gcc 12 on ppc64le Date: Thu, 23 Mar 2023 13:01:45 -0400 Message-Id: <20230323170145.129901-1-drc@linux.vnet.ibm.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230322212439.524725-1-drc@linux.vnet.ibm.com> References: <20230322212439.524725-1-drc@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-GUID: Cp5iIQjSoNQgWh3lOds8IwBAaY_wB4bR X-Proofpoint-ORIG-GUID: Cp5iIQjSoNQgWh3lOds8IwBAaY_wB4bR X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-03-22_21,2023-03-23_02,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 bulkscore=0 mlxlogscore=999 adultscore=0 lowpriorityscore=0 spamscore=0 mlxscore=0 phishscore=0 impostorscore=0 priorityscore=1501 malwarescore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303150002 definitions=main-2303230120 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 Building DPDK with gcc 12 on a ppc64le system generates a stringop-overflow warning. Replace the local MAC address validation function parse_user_mac() with a call to rte_ether_unformat_addr() instead. Bugzilla ID: 1197 Cc: stable@dpdk.org Signed-off-by: David Christensen --- v2: * Added NULL checks previously performed in parse_user_mac() --- drivers/net/tap/rte_eth_tap.c | 26 ++------------------------ 1 file changed, 2 insertions(+), 24 deletions(-) diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c index 089ac202fa..8c50801fd4 100644 --- a/drivers/net/tap/rte_eth_tap.c +++ b/drivers/net/tap/rte_eth_tap.c @@ -2267,29 +2267,6 @@ set_remote_iface(const char *key __rte_unused, return 0; } -static int parse_user_mac(struct rte_ether_addr *user_mac, - const char *value) -{ - unsigned int index = 0; - char mac_temp[strlen(ETH_TAP_USR_MAC_FMT) + 1], *mac_byte = NULL; - - if (user_mac == NULL || value == NULL) - return 0; - - strlcpy(mac_temp, value, sizeof(mac_temp)); - mac_byte = strtok(mac_temp, ":"); - - while ((mac_byte != NULL) && - (strlen(mac_byte) <= 2) && - (strlen(mac_byte) == strspn(mac_byte, - ETH_TAP_CMP_MAC_FMT))) { - user_mac->addr_bytes[index++] = strtoul(mac_byte, NULL, 16); - mac_byte = strtok(NULL, ":"); - } - - return index; -} - static int set_mac_type(const char *key __rte_unused, const char *value, @@ -2311,7 +2288,8 @@ set_mac_type(const char *key __rte_unused, goto success; } - if (parse_user_mac(user_mac, value) != 6) + if (value == NULL || user_mac == NULL || + rte_ether_unformat_addr(value, user_mac) < 0) goto error; success: TAP_LOG(DEBUG, "TAP user MAC param (%s)", value); -- 2.31.1