From: "Min Hu (Connor)" <humin29@huawei.com>
To: Ferruh Yigit <ferruh.yigit@amd.com>,
Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>, <dev@dpdk.org>
Cc: <thomas@monjalon.net>
Subject: Re: [PATCH 05/12] net/hns3: fix an unreasonable memset
Date: Fri, 20 May 2022 19:00:31 +0800 [thread overview]
Message-ID: <3b31ec33-3992-7ce4-ac32-30fa96ca0d7a@huawei.com> (raw)
In-Reply-To: <ade8e5ee-75ec-2a54-f689-83e799f98e24@amd.com>
Hi,
在 2022/5/20 18:43, Ferruh Yigit 写道:
> 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 <lihuisong@huawei.com>
>>>>>>
>>>>>> 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 <lihuisong@huawei.com>
>>>>>> Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
>>>>>> ---
>>>>>> 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.
thanks Ferruh.
>
> +1 to main purpose of the patch (to replace 'sizeof(uint16_t)').
> .
next prev parent reply other threads:[~2022-05-20 11:00 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-19 12:29 [PATCH 00/12] bugfix for hns3 PMD Min Hu (Connor)
2022-05-19 12:29 ` [PATCH 01/12] net/hns3: fix spelling errors Min Hu (Connor)
2022-05-19 12:29 ` [PATCH 02/12] net/hns3: add check for deferred start queue when rollback Min Hu (Connor)
2022-05-19 12:29 ` [PATCH 03/12] net/hns3: remove redundant parentheses Min Hu (Connor)
2022-05-19 12:29 ` [PATCH 04/12] net/hns3: adjust the data type of some variables Min Hu (Connor)
2022-05-19 12:29 ` [PATCH 05/12] net/hns3: fix an unreasonable memset Min Hu (Connor)
2022-05-20 7:58 ` Andrew Rybchenko
2022-05-20 8:37 ` Min Hu (Connor)
2022-05-20 8:59 ` Andrew Rybchenko
2022-05-20 9:14 ` Min Hu (Connor)
2022-05-20 10:43 ` Ferruh Yigit
2022-05-20 11:00 ` Min Hu (Connor) [this message]
2022-05-19 12:29 ` [PATCH 06/12] net/hns3: remove duplicate definition Min Hu (Connor)
2022-05-19 12:29 ` [PATCH 07/12] net/hns3: fix coverity codecheck Min Hu (Connor)
2022-05-19 12:29 ` [PATCH 08/12] net/hns3: fix return value for unsupported tuple Min Hu (Connor)
2022-05-19 12:29 ` [PATCH 09/12] net/hns3: modify a function name Min Hu (Connor)
2022-05-19 12:29 ` [PATCH 10/12] net/hns3: unify the code wrap style Min Hu (Connor)
2022-05-19 12:29 ` [PATCH 11/12] net/hns3: fix a segfault from secondary process Min Hu (Connor)
2022-05-19 12:29 ` [PATCH 12/12] net/hns3: fix TM capability incorrectly defined Min Hu (Connor)
2022-05-31 14:55 ` [PATCH 00/12] bugfix for hns3 PMD Andrew Rybchenko
2022-06-01 3:54 ` Min Hu (Connor)
2022-06-01 3:52 ` [PATCH v2 00/11] " Min Hu (Connor)
2022-06-01 3:52 ` [PATCH v2 01/11] net/hns3: add check for deferred start queue when rollback Min Hu (Connor)
2022-06-01 3:52 ` [PATCH v2 02/11] net/hns3: remove redundant parentheses Min Hu (Connor)
2022-06-01 3:52 ` [PATCH v2 03/11] net/hns3: adjust the data type of some variables Min Hu (Connor)
2022-06-01 3:52 ` [PATCH v2 04/11] net/hns3: fix an unreasonable memset Min Hu (Connor)
2022-06-01 3:52 ` [PATCH v2 05/11] net/hns3: remove duplicate definition Min Hu (Connor)
2022-06-01 3:52 ` [PATCH v2 06/11] net/hns3: fix coverity codecheck Min Hu (Connor)
2022-06-01 8:32 ` Andrew Rybchenko
2022-06-06 7:48 ` Dongdong Liu
2022-06-08 11:19 ` Andrew Rybchenko
2022-06-08 12:04 ` Dongdong Liu
2022-06-01 3:52 ` [PATCH v2 07/11] net/hns3: fix return value for unsupported tuple Min Hu (Connor)
2022-06-01 3:52 ` [PATCH v2 08/11] net/hns3: modify a function name Min Hu (Connor)
2022-06-01 3:52 ` [PATCH v2 09/11] net/hns3: unify the code wrap style Min Hu (Connor)
2022-06-01 3:52 ` [PATCH v2 10/11] net/hns3: fix a segfault from secondary process Min Hu (Connor)
2022-06-01 3:52 ` [PATCH v2 11/11] net/hns3: fix TM capability incorrectly defined Min Hu (Connor)
2022-06-09 10:57 ` [PATCH v2 00/11] bugfix for hns3 PMD Andrew Rybchenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3b31ec33-3992-7ce4-ac32-30fa96ca0d7a@huawei.com \
--to=humin29@huawei.com \
--cc=andrew.rybchenko@oktetlabs.ru \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@amd.com \
--cc=thomas@monjalon.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).