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 5ED3242B1A for ; Tue, 16 May 2023 01:15:03 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5248C42B8E; Tue, 16 May 2023 01:15:03 +0200 (CEST) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2052.outbound.protection.outlook.com [40.107.244.52]) by mails.dpdk.org (Postfix) with ESMTP id 6657F4068E; Tue, 16 May 2023 01:15:00 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MBfu5KWfL3MJF7aSAbK5qpTcMTTz2Sv4tCyY+TS75ivJnYbVuJ8quuuEL9hgJMJfGiUZ3U1p1luvA/akd/f+c3SJTGQeeco1TBW8AyoKfRU8vdS0uSti7d7aCF2x6YryQQY1t7BAfRoiHO1BdRcgBBWqxWJlXwROr6ngW5SPN4mcsaXntuLg0O9Oepq8enztenwOZ6Q2e1bEAjF6Vd3ikY7JnqVRgnPO/9ehOZiJGVxOdfVQUvvED7B9PeMhdSNp0X+wq5s6gGjuOVx4H36MnGXAafqH+QK87lmJ2GViVpCKE4Tchqx4LiQbUKHjexaFcsg46oa/be/L2oxPFVblrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=vcaXB1sD0oCKYJgY1XlTVmLdcyVmYu68u76wd1P64mQ=; b=TgbC4Zaw68ILx54uE5O5ta6uhdzOVOV1L9QTYDcKmOBjonwDcNytREDmxK06N4m8B6X94JKrgnfK/dPXcQBVYKqDfYkBz7bzeCNtCiduO0X4k3wR0IgNL9t7Uip69rqHQUjMXoDJsuZFL6lnNabIWxxy874BsNIX76MaE1Wvo1UVR4N5F/LGHR1q7KVCSM+B1mgO1JekM1YNJ+bUFLuns4zMax/qqdXL4G62PXujzqHdNE6xpNfp5Mkhv5avNjJ6iQ8PqoDZx7dIzTVQ6vtLAn52y9FJ5Co21azGl9qx473UzysJyiW1jNo+SpkdZD0yuf1dUKbiYTMllFdwUV6CUw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=vcaXB1sD0oCKYJgY1XlTVmLdcyVmYu68u76wd1P64mQ=; b=QgbvNTecklKu/9IlA9ta/ACSH54h6MDyfvfMFzn0FIBcMp81wnrQhOB91+8sCmHNPEQ++hArtNsYnt3iAveLTP5PO/l8iopIfhEb46LIFUPaYC2eI/VARuCQWctVdFgo7KNJSwaNPB7WggcOQmjoqI/OfKaVaPFRXtWagPsPu0g= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; Received: from CH2PR12MB4294.namprd12.prod.outlook.com (2603:10b6:610:a9::11) by PH0PR12MB5483.namprd12.prod.outlook.com (2603:10b6:510:ee::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6387.30; Mon, 15 May 2023 23:14:58 +0000 Received: from CH2PR12MB4294.namprd12.prod.outlook.com ([fe80::7957:641d:6aba:3f9a]) by CH2PR12MB4294.namprd12.prod.outlook.com ([fe80::7957:641d:6aba:3f9a%4]) with mapi id 15.20.6387.030; Mon, 15 May 2023 23:14:57 +0000 Message-ID: <165a233b-b41b-3a65-1866-5b7c94993b40@amd.com> Date: Tue, 16 May 2023 00:14:52 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Content-Language: en-US To: David Christensen , dev@dpdk.org, stephen@networkplumber.org Cc: stable@dpdk.org, Stephen Hemminger References: <20230322212439.524725-1-drc@linux.vnet.ibm.com> <20230323170145.129901-1-drc@linux.vnet.ibm.com> From: Ferruh Yigit Subject: Re: [PATCH v2] net/tap: resolve stringop-overflow with gcc 12 on ppc64le In-Reply-To: <20230323170145.129901-1-drc@linux.vnet.ibm.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: LO4P123CA0047.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:152::16) To CH2PR12MB4294.namprd12.prod.outlook.com (2603:10b6:610:a9::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH2PR12MB4294:EE_|PH0PR12MB5483:EE_ X-MS-Office365-Filtering-Correlation-Id: 2d6b542a-7a25-410c-0760-08db559a32da X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ROuqwS3Csq9+KtoAUURDXeZ+HcgthT989AiZQAYGQ1iDhmaeh1C3vWj3vRhC+lzx/pX51lu3JbU0anUThEtJimiO3k6qiPWFk8+YKJzrrhwG0ji30t8hh67YZHH07RunkLvjYtgH5OZDjHaBdOF8d4WlbKDeHL8m7i3QInaVYEAUWrc0NKQUQzmj9T5QqB7Ygi7ofyNT3Djq6phPD7NqoRa/edwa0JfJ0pKsVuLSrykCkqOZcEDtHc5FXCXsS6ePC2LH2O5u6qHo8is4x8ujT4Dn5vuOOjSb6SGkj1ybw9GtxsbdR1J+azqBK+5myM9XVskPuN6Kp2XHw4Ji4LQsdDFW608To5jFFcAEXxNFFxi4f6+o1qmeDY7reqXUmfBQDelJYOnhVV8T3lfSOLZRj+JIglYy4u872RI9Sfx5Vf7cPPuSvDTk4ZHpU4fDRJgfMTPekHqXW/JfgTPR4VnwIErdRY96bBkybgLrBpOLPP6Q0YEheXcCraLw9PpaAolFh5YUlQcP3R88fKuGk5B+bOSiyGsMgFSyulNpYKkqxQ60ORgGU9xftZY5F15cT6UOwTlz8vCeWRGtbNIT340T9bGWYOx+VvnhrxXPJ0nkgCGqETyODUcSMsWpbYehRXEkWZcJmXozuTpuN2ISdMJQmQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CH2PR12MB4294.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(4636009)(39860400002)(396003)(346002)(376002)(136003)(366004)(451199021)(31686004)(83380400001)(4326008)(316002)(41300700001)(36756003)(38100700002)(53546011)(6512007)(26005)(6506007)(6486002)(478600001)(66556008)(66946007)(66476007)(2616005)(86362001)(8676002)(44832011)(31696002)(2906002)(8936002)(5660300002)(186003)(6666004)(43740500002)(45980500001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?aEpJWFpxSi8vVVVUb29wN3JVNnlmaEFIczgvK24zUyttZFFEL2h0bDRnUUJ3?= =?utf-8?B?ZmZUbkJmKzFqSW9QYnlMdEVLbzRGN0hzNzlyeWNhejk5MXRtYzBXTHNhNWgz?= =?utf-8?B?Nm9wc3dpMkVobkQvZGxBOXlCd0J6TUNPSm9IZ3BSOTZBRDR3akk4NkhGajRs?= =?utf-8?B?WmEyenNKTFN6SzAwQU9QVVdLeGZPcFNqNStqaWM2OXQ4YXFCK0gwVjNSU0pw?= =?utf-8?B?NkNkMG9TTHZnYU43T1BpUGt1OWV1YTFaSmc3YVpMTUZZQUZCbUFTSSthOHg5?= =?utf-8?B?VVRQTi9GbHF4Ujh2M2xwbGdMZ0w3cUpjejNqMW5RSERTZXljU1krZ1VBb3pX?= =?utf-8?B?OWF0aGgxRk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g: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2d6b542a-7a25-410c-0760-08db559a32da X-MS-Exchange-CrossTenant-AuthSource: CH2PR12MB4294.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 May 2023 23:14:57.2430 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: +d9j+OQ0GI6uqm+kPrJz3OewFBFtEv7dG/ob/ohcGlcLv2j8vHLne3WiFQPdH4gG X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR12MB5483 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 On 3/23/2023 5:01 PM, David Christensen wrote: > 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); Hi David, I confirm the build error, btw it helps to future references to put build failure to the commit log, and change is reasonable to convert PMD local parse function to an API, BUT my concern is they don't behave exactly same, which changes user interface of the driver. The 'rte_ether_unformat_addr()' API expects exact "XX:XX:XX:XX:XX:XX or XXXX:XXXX:XXXX" format. Like 'parse_user_mac()' accepts 'a:a:a:a:a:a' as input, but API requires '0A:0A:0A:0A:0A:0A'. This is a small change but still may create a bad experience if an existing user/script hit by this, and I believe we don't have a strong reason to change the interface. To keep behavior same, we can either update 'rte_ether_unformat_addr()' to accept singe chars between ':', or fix the existing 'parse_user_mac()' for compiler warning, what do you think?