* [PATCH net] cxgb4: Initialize data structures before using.
@ 2012-11-06 13:37 Vipul Pandya
2012-11-07 11:12 ` Viral Mehta
2012-11-07 20:43 ` David Miller
0 siblings, 2 replies; 4+ messages in thread
From: Vipul Pandya @ 2012-11-06 13:37 UTC (permalink / raw)
To: netdev; +Cc: davem, divy, dm, Vipul Pandya, Jay Hernandez
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));
INIT_CMD(c, BYE, WRITE);
return t4_wr_mbox(adap, mbox, &c, sizeof(c), NULL);
}
@@ -2535,6 +2536,7 @@ int t4_early_init(struct adapter *adap, unsigned int mbox)
{
struct fw_initialize_cmd c;
+ memset(&c, 0, sizeof(c));
INIT_CMD(c, INITIALIZE, WRITE);
return t4_wr_mbox(adap, mbox, &c, sizeof(c), NULL);
}
@@ -2551,6 +2553,7 @@ int t4_fw_reset(struct adapter *adap, unsigned int mbox, int reset)
{
struct fw_reset_cmd c;
+ memset(&c, 0, sizeof(c));
INIT_CMD(c, RESET, WRITE);
c.val = htonl(reset);
return t4_wr_mbox(adap, mbox, &c, sizeof(c), NULL);
@@ -3278,6 +3281,7 @@ int t4_identify_port(struct adapter *adap, unsigned int mbox, unsigned int viid,
{
struct fw_vi_enable_cmd c;
+ memset(&c, 0, sizeof(c));
c.op_to_viid = htonl(FW_CMD_OP(FW_VI_ENABLE_CMD) | FW_CMD_REQUEST |
FW_CMD_EXEC | FW_VI_ENABLE_CMD_VIID(viid));
c.ien_to_len16 = htonl(FW_VI_ENABLE_CMD_LED | FW_LEN16(c));
--
1.7.1
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH net] cxgb4: Initialize data structures before using.
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
2012-11-07 20:43 ` David Miller
1 sibling, 1 reply; 4+ messages in thread
From: Viral Mehta @ 2012-11-07 11:12 UTC (permalink / raw)
To: Vipul Pandya; +Cc: netdev, David S. Miller, divy, dm, Jay Hernandez
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 ?
Thanks,
Viral
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH net] cxgb4: Initialize data structures before using.
2012-11-07 11:12 ` Viral Mehta
@ 2012-11-07 19:31 ` David Miller
0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2012-11-07 19:31 UTC (permalink / raw)
To: viral.vkm; +Cc: vipul, netdev, divy, dm, jay
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.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net] cxgb4: Initialize data structures before using.
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 20:43 ` David Miller
1 sibling, 0 replies; 4+ messages in thread
From: David Miller @ 2012-11-07 20:43 UTC (permalink / raw)
To: vipul; +Cc: netdev, divy, dm, jay
From: Vipul Pandya <vipul@chelsio.com>
Date: Tue, 6 Nov 2012 19:07:09 +0530
> 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>
Applied, thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-11-07 20:43 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2012-11-07 20:43 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox