Thread (4 messages) flat view 4 messages, 3 authors, 2012-11-07

Re: [PATCH net] cxgb4: Initialize data structures before using.

From: David Miller <davem@davemloft.net>
Date: 2012-11-07 19:31:31

From: Viral Mehta <redacted>
Date: Wed, 7 Nov 2012 16:42:09 +0530
Hi,

On Tue, Nov 6, 2012 at 7:07 PM, Vipul Pandya [off-list ref] wrote:
quoted
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 <redacted>
Signed-off-by: Vipul Pandya <redacted>
---
 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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help