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 001EDA0503; Fri, 20 May 2022 12:43:46 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D3C27427ED; Fri, 20 May 2022 12:43:46 +0200 (CEST) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2058.outbound.protection.outlook.com [40.107.223.58]) by mails.dpdk.org (Postfix) with ESMTP id 9BE5F40222 for ; Fri, 20 May 2022 12:43:45 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Y+rArSM1ifZCaGCpUWzOSTkH3rz4gEk4vMS/kpyB10tqsSizMMWnGSOAxZU7k8eYNB8AH2lHN1Irda5yR+IvXJfsBWalWm7tdoG+mpKjQnkRuiKlsw7C/6izCf1t2oqoUWCzB60Mcp4zsmd3qGOze0hGDR9T20i76Dv7CLuYKd68Or930x95klvPMb20kx10vXLW2XR8xy7RDez6JsipZnJyPaty+3W/QbV7HZvIk+ouMleuH6zcxXjQ6KCuazNUeWOyvamY5StSvoyfk/F15jCGfu9vDPCmTApws042jAOPo+ovJlUGWIYifIrW+orsPSlsGymd36pggRl8FvBw5g== 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=uMouw4flnBk2/VheCxDLK/Sd//Zctw/b6oX+XhmMBpg=; b=MMbRfNLVl7HWBszCkdj7e+kfpQL+4MCErudrH2Oa1j3KgB6a4Wfk+1MZF33wHP1txQ/tLPPi9j80L1K9wHq2LotPJOr7YyvUVu+7DkjtKmXt7QUVoQkdhL9ZbvOPiIWwQunoq72WILcO8InUsg/h14OWBKiuyWXY8teKcrSOv8GAXUev27HX/FOX3RK6L7TMF8hqEhskiDUysKU5MhjNAs0qFwy8jrFMBZxrAldv83wWANy7RLT7OebhUl0eRWq5g9EvLFat4Q2v7Lygbkps5JrWm32BioFFAwmaUBnkj/BhOBVb8KCpj3056jdjFIErrQSD8FL4PnS9zA983JzYYA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=softfail (sender ip is 149.199.80.198) smtp.rcpttodomain=huawei.com smtp.mailfrom=amd.com; dmarc=fail (p=quarantine sp=quarantine pct=100) action=quarantine header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=uMouw4flnBk2/VheCxDLK/Sd//Zctw/b6oX+XhmMBpg=; b=aqLVcUDPFpaEZfd2nnHoyf1RCKkWztiLx9OJWPGc2Lo68WBQUfLvUtdifWXNDIWBD0cBaXXbODZ3wuRoxgLoDyMPmRgtz9Xs4rgAEwmt1BJE9PPsDlhdWenzxz58NNH1c2c/V1qHrAwAo9luTMYQiD4pXXkry07CtcjetBYy7Cg= Received: from SN1PR12CA0113.namprd12.prod.outlook.com (2603:10b6:802:21::48) by BYAPR02MB5528.namprd02.prod.outlook.com (2603:10b6:a03:9b::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5250.17; Fri, 20 May 2022 10:43:42 +0000 Received: from SN1NAM02FT0034.eop-nam02.prod.protection.outlook.com (2603:10b6:802:21:cafe::19) by SN1PR12CA0113.outlook.office365.com (2603:10b6:802:21::48) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5273.14 via Frontend Transport; Fri, 20 May 2022 10:43:42 +0000 X-MS-Exchange-Authentication-Results: spf=softfail (sender IP is 149.199.80.198) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=fail action=quarantine header.from=amd.com; Received-SPF: SoftFail (protection.outlook.com: domain of transitioning amd.com discourages use of 149.199.80.198 as permitted sender) Received: from xir-pvapexch02.xlnx.xilinx.com (149.199.80.198) by SN1NAM02FT0034.mail.protection.outlook.com (10.97.5.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5273.14 via Frontend Transport; Fri, 20 May 2022 10:43:41 +0000 Received: from xir-pvapexch01.xlnx.xilinx.com (172.21.17.15) by xir-pvapexch02.xlnx.xilinx.com (172.21.17.17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.14; Fri, 20 May 2022 11:43:39 +0100 Received: from smtp.xilinx.com (172.21.105.197) by xir-pvapexch01.xlnx.xilinx.com (172.21.17.15) with Microsoft SMTP Server id 15.1.2176.14 via Frontend Transport; Fri, 20 May 2022 11:43:39 +0100 Envelope-to: humin29@huawei.com, andrew.rybchenko@oktetlabs.ru, dev@dpdk.org, thomas@monjalon.net Received: from [10.71.116.9] (port=65108) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1ns06d-0004ry-MY; Fri, 20 May 2022 11:43:39 +0100 Message-ID: Date: Fri, 20 May 2022 11:43:39 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.9.0 Subject: Re: [PATCH 05/12] net/hns3: fix an unreasonable memset Content-Language: en-US To: "Min Hu (Connor)" , Andrew Rybchenko , CC: References: <20220519122917.2334-1-humin29@huawei.com> <20220519122917.2334-6-humin29@huawei.com> <1c148094-3550-b78e-7c23-1819582a83ff@oktetlabs.ru> <19acdf78-af14-25fa-a52b-8b1f96d3fcb3@huawei.com> <02c76cd2-da56-7619-d52a-fa997bc81106@oktetlabs.ru> <3024730f-ca6a-e82e-2c7d-80c41d4fd6ad@huawei.com> From: Ferruh Yigit In-Reply-To: <3024730f-ca6a-e82e-2c7d-80c41d4fd6ad@huawei.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 50e0438c-e26b-4863-8daf-08da3a4d9b01 X-MS-TrafficTypeDiagnostic: BYAPR02MB5528:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 2 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4vbamG94CRFmMxai7I0uSPb1FUGxFvpdVepKHADR6kOj+OcSCFhodUE8DvdstfEXaaP9XBH+TCsUZPyc4Jl0kqYJqD+aoAKY3pc4HuSteF7ENsIDfWM0rYAeox6mEviJsFEbeN/jj/7pC+Bd4LY3J8KqAkxJL6ZHufvDMZH5et5n3DDwMrAXUw4wpG5w1YHVzs9w7Oik6+YNFVGKUbDUCnOIhQnDADz+QFGcYo9tlW/cM5FcpT4IZbR2afnj+Pkj7KQuaZ9bX6P8uZELRwvGU+hqnK1Ddm1aModUNdKjbb2ZnTejLmCdIvj6oWAhpqO6xtP6QPDuRRUC943lJD371mM2zyaYSVaUdb5qlnvyq5amQ037bQTNpqpqLkzyCbevo+sedVube5STSn7UHCsCkdfL8AVKjmyOPp4EIVEomslGQqim7KgUTHeg+6N80T85y6GxP/nkKjBTu+vEQmi+uX8EcKhvV3t1Ra1u3XOzflvM0j6FIYcZnMLYMtpjYM1LC8cS76NuwvcNItxrnY2Ga9rzxL46iopUq8Bw19hCezrCYegmw17CiR7lcxVah1aTydL3EwEINF4ZzsmjFHel/DvWYk1yWwPC2NSK5o8pkHxAIwl6uOhIPzNOMROuWRXtlK93U45ARa0jFnLpju6W7F5An27ecxaIY6NqEp5wT87m/2irhl4429BerZr7kzyAAPQtTM6XN2Y2Uvv4IFE/4XhTpA5r4XDmj6zVUVpcUts= X-Forefront-Antispam-Report: CIP:149.199.80.198; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:xir-pvapexch02.xlnx.xilinx.com; PTR:unknown-80-198.xilinx.com; CAT:NONE; SFS:(13230001)(4636009)(40470700004)(46966006)(356005)(83380400001)(2906002)(8676002)(53546011)(4326008)(44832011)(40460700003)(8936002)(9786002)(70586007)(86362001)(7636003)(508600001)(31696002)(36756003)(110136005)(26005)(5660300002)(316002)(47076005)(336012)(70206006)(82310400005)(31686004)(35950700001)(2616005)(50156003)(43740500002); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.onmicrosoft.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 May 2022 10:43:41.0997 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 50e0438c-e26b-4863-8daf-08da3a4d9b01 X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.80.198]; Helo=[xir-pvapexch02.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: SN1NAM02FT0034.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR02MB5528 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On 5/20/2022 10:14 AM, Min Hu (Connor) wrote: > [CAUTION: External Email] > > Hi,Andrew, > > 在 2022/5/20 16:59, Andrew Rybchenko 写道: >> On 5/20/22 11:37, Min Hu (Connor) wrote: >>> Hi, Andrew , >>> >>> 在 2022/5/20 15:58, Andrew Rybchenko 写道: >>>> On 5/19/22 15:29, Min Hu (Connor) wrote: >>>>> From: Huisong Li >>>>> >>>>> This patch fixes an unreasonable memset. >>>>> >>>>> Fixes: bba636698316 ("net/hns3: support Rx/Tx and related operations") >>>>> Cc: stable@dpdk.org >>>>> >>>>> Signed-off-by: Huisong Li >>>>> Signed-off-by: Min Hu (Connor) >>>>> --- >>>>>   drivers/net/hns3/hns3_rxtx.c | 2 +- >>>>>   1 file changed, 1 insertion(+), 1 deletion(-) >>>>> >>>>> diff --git a/drivers/net/hns3/hns3_rxtx.c >>>>> b/drivers/net/hns3/hns3_rxtx.c >>>>> index 510802be05..5a2cfe5a54 100644 >>>>> --- a/drivers/net/hns3/hns3_rxtx.c >>>>> +++ b/drivers/net/hns3/hns3_rxtx.c >>>>> @@ -776,7 +776,7 @@ hns3vf_reset_all_tqps(struct hns3_hw *hw) >>>>>       int ret; >>>>>       uint16_t i; >>>>> -    memset(msg_data, 0, sizeof(uint16_t)); >>>>> +    memset(msg_data, 0, sizeof(msg_data)); >>>> >>>> It looks a bit suspicious. May be it is better to do: >>>>      memset(&msg_data, 0, sizeof(msg_data)); >>> I think this is too hard to understand for &msg_data is **p. >>> maybe it confuse others when use memset to operate level-2 pointer. >> >> msg_data == &amsg_data >> since it is an array > Yes, you are right, the address of 'msg_data ' is the same > as the address of '&amsg_data'. > > But I still think this usage is not common. > like the current code in DPDK: > ***** > static int > app_parse_flow_conf(const char *conf_str) > { >        int ret; >        uint32_t vals[5]; >        struct flow_conf *pconf; >        uint64_t mask; > >        memset(vals, 0, sizeof(vals)); > ... > ***** > > how about others's opinion? @Ferruh, @Thomas. > I would use array without address operator, so original patch lgtm. +1 to main purpose of the patch (to replace 'sizeof(uint16_t)').