[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20121107.143127.2060314019851524050.davem@davemloft.net>
Date: Wed, 07 Nov 2012 14:31:27 -0500 (EST)
From: David Miller <davem@...emloft.net>
To: viral.vkm@...il.com
Cc: vipul@...lsio.com, netdev@...r.kernel.org, divy@...lsio.com,
dm@...lsio.com, jay@...lsio.com
Subject: Re: [PATCH net] cxgb4: Initialize data structures before using.
From: Viral Mehta <viral.vkm@...il.com>
Date: Wed, 7 Nov 2012 16:42:09 +0530
> Hi,
>
> On Tue, Nov 6, 2012 at 7:07 PM, Vipul Pandya <vipul@...lsio.com> wrote:
>>
>> We should not assume reserve fields to be don't cares as fields may change.
>> Clearing data structures before using.
>>
>> Signed-off-by: Jay Hernandez <jay@...lsio.com>
>> Signed-off-by: Vipul Pandya <vipul@...lsio.com>
>> ---
>> drivers/net/ethernet/chelsio/cxgb4/t4_hw.c | 4 ++++
>> 1 files changed, 4 insertions(+), 0 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
>> index 32eec15..01fa5b7 100644
>> --- a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
>> +++ b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
>> @@ -2519,6 +2519,7 @@ int t4_fw_bye(struct adapter *adap, unsigned int mbox)
>> {
>> struct fw_bye_cmd c;
>>
>> + memset(&c, 0, sizeof(c));
>
> struct fw_byte_cmd c = {0};
>
> Isn't it better ?
There is no fundamental difference, as far as the compiler and
optimizations are concerned, it's pretty much identical.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists