Netdev List
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: viral.vkm@gmail.com
Cc: vipul@chelsio.com, netdev@vger.kernel.org, divy@chelsio.com,
	dm@chelsio.com, jay@chelsio.com
Subject: Re: [PATCH net] cxgb4: Initialize data structures before using.
Date: Wed, 07 Nov 2012 14:31:27 -0500 (EST)	[thread overview]
Message-ID: <20121107.143127.2060314019851524050.davem@davemloft.net> (raw)
In-Reply-To: <CANX6Dak5pFutKVn7hV_8-tYx4h67-gS2ud=CrArN--9e=ica5Q@mail.gmail.com>

From: Viral Mehta <viral.vkm@gmail.com>
Date: Wed, 7 Nov 2012 16:42:09 +0530

> Hi,
> 
> On Tue, Nov 6, 2012 at 7:07 PM, Vipul Pandya <vipul@chelsio.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@chelsio.com>
>> Signed-off-by: Vipul Pandya <vipul@chelsio.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.

  reply	other threads:[~2012-11-07 19:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-06 13:37 [PATCH net] cxgb4: Initialize data structures before using Vipul Pandya
2012-11-07 11:12 ` Viral Mehta
2012-11-07 19:31   ` David Miller [this message]
2012-11-07 20:43 ` David Miller

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=20121107.143127.2060314019851524050.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=divy@chelsio.com \
    --cc=dm@chelsio.com \
    --cc=jay@chelsio.com \
    --cc=netdev@vger.kernel.org \
    --cc=vipul@chelsio.com \
    --cc=viral.vkm@gmail.com \
    /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