Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1535680

[PATCH V2 net 15/20] net/ena: change sizeof() argument to be the type pointer

From Netanel Belgazal <netanel@annapurnalabs.com>
Newsgroups linux.kernel
Subject [PATCH V2 net 15/20] net/ena: change sizeof() argument to be the type pointer
Date 2016-12-04 14:30 +0100
Message-ID <sKF1E-7FZ-41@gated-at.bofh.it> (permalink)
References <sKF1D-7FZ-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Instead of using:
memset(ptr, 0x0, sizeof(struct ...))
use:
memset(ptr, 0x0, sizeor(*ptr))

Signed-off-by: Netanel Belgazal <netanel@annapurnalabs.com>
---
 drivers/net/ethernet/amazon/ena/ena_com.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ethernet/amazon/ena/ena_com.c b/drivers/net/ethernet/amazon/ena/ena_com.c
index 9deb0dd..f2e167b 100644
--- a/drivers/net/ethernet/amazon/ena/ena_com.c
+++ b/drivers/net/ethernet/amazon/ena/ena_com.c
@@ -329,7 +329,7 @@ static int ena_com_init_io_sq(struct ena_com_dev *ena_dev,
 	size_t size;
 	int dev_node = 0;
 
-	memset(&io_sq->desc_addr, 0x0, sizeof(struct ena_com_io_desc_addr));
+	memset(&io_sq->desc_addr, 0x0, sizeof(io_sq->desc_addr));
 
 	io_sq->desc_entry_size =
 		(io_sq->direction == ENA_COM_IO_QUEUE_DIRECTION_TX) ?
@@ -383,7 +383,7 @@ static int ena_com_init_io_cq(struct ena_com_dev *ena_dev,
 	size_t size;
 	int prev_node = 0;
 
-	memset(&io_cq->cdesc_addr, 0x0, sizeof(struct ena_com_io_desc_addr));
+	memset(&io_cq->cdesc_addr, 0x0, sizeof(io_cq->cdesc_addr));
 
 	/* Use the basic completion descriptor for Rx */
 	io_cq->cdesc_entry_size_in_bytes =
@@ -681,7 +681,7 @@ static int ena_com_destroy_io_sq(struct ena_com_dev *ena_dev,
 	u8 direction;
 	int ret;
 
-	memset(&destroy_cmd, 0x0, sizeof(struct ena_admin_aq_destroy_sq_cmd));
+	memset(&destroy_cmd, 0x0, sizeof(destroy_cmd));
 
 	if (io_sq->direction == ENA_COM_IO_QUEUE_DIRECTION_TX)
 		direction = ENA_ADMIN_SQ_DIRECTION_TX;
@@ -963,7 +963,7 @@ static int ena_com_create_io_sq(struct ena_com_dev *ena_dev,
 	u8 direction;
 	int ret;
 
-	memset(&create_cmd, 0x0, sizeof(struct ena_admin_aq_create_sq_cmd));
+	memset(&create_cmd, 0x0, sizeof(create_cmd));
 
 	create_cmd.aq_common_descriptor.opcode = ENA_ADMIN_CREATE_SQ;
 
@@ -1155,7 +1155,7 @@ int ena_com_create_io_cq(struct ena_com_dev *ena_dev,
 	struct ena_admin_acq_create_cq_resp_desc cmd_completion;
 	int ret;
 
-	memset(&create_cmd, 0x0, sizeof(struct ena_admin_aq_create_cq_cmd));
+	memset(&create_cmd, 0x0, sizeof(create_cmd));
 
 	create_cmd.aq_common_descriptor.opcode = ENA_ADMIN_CREATE_CQ;
 
@@ -1263,7 +1263,7 @@ int ena_com_destroy_io_cq(struct ena_com_dev *ena_dev,
 	struct ena_admin_acq_destroy_cq_resp_desc destroy_resp;
 	int ret;
 
-	memset(&destroy_cmd, 0x0, sizeof(struct ena_admin_aq_destroy_sq_cmd));
+	memset(&destroy_cmd, 0x0, sizeof(destroy_cmd));
 
 	destroy_cmd.cq_idx = io_cq->idx;
 	destroy_cmd.aq_common_descriptor.opcode = ENA_ADMIN_DESTROY_CQ;
@@ -1613,8 +1613,8 @@ int ena_com_create_io_queue(struct ena_com_dev *ena_dev,
 	io_sq = &ena_dev->io_sq_queues[ctx->qid];
 	io_cq = &ena_dev->io_cq_queues[ctx->qid];
 
-	memset(io_sq, 0x0, sizeof(struct ena_com_io_sq));
-	memset(io_cq, 0x0, sizeof(struct ena_com_io_cq));
+	memset(io_sq, 0x0, sizeof(*io_sq));
+	memset(io_cq, 0x0, sizeof(*io_cq));
 
 	/* Init CQ */
 	io_cq->q_depth = ctx->queue_size;
-- 
2.7.4

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH V2 net 00/20] Increase ENA driver version to 1.1.2 Netanel Belgazal <netanel@annapurnalabs.com> - 2016-12-04 14:30 +0100
  [PATCH V2 net 05/20] net/ena: fix RSS default hash configuration Netanel Belgazal <netanel@annapurnalabs.com> - 2016-12-04 14:30 +0100
    Re: [PATCH V2 net 05/20] net/ena: fix RSS default hash configuration Matt Wilson <msw@amzn.com> - 2016-12-05 05:30 +0100
      Re: [PATCH V2 net 05/20] net/ena: fix RSS default hash configuration Netanel Belgazal <netanel@annapurnalabs.com> - 2016-12-05 19:40 +0100
  [PATCH V2 net 13/20] net/ena: change driver's default timeouts Netanel Belgazal <netanel@annapurnalabs.com> - 2016-12-04 14:30 +0100
    Re: [PATCH V2 net 13/20] net/ena: change driver's default timeouts Matt Wilson <msw@amzn.com> - 2016-12-05 05:40 +0100
      Re: [PATCH V2 net 13/20] net/ena: change driver's default timeouts Netanel Belgazal <netanel@annapurnalabs.com> - 2016-12-05 19:30 +0100
  [PATCH V2 net 08/20] net/ena: add hardware hints capability to the driver Netanel Belgazal <netanel@annapurnalabs.com> - 2016-12-04 14:30 +0100
    Re: [PATCH V2 net 08/20] net/ena: add hardware hints capability to  the driver Matt Wilson <msw@amzn.com> - 2016-12-05 05:40 +0100
      Re: [PATCH V2 net 08/20] net/ena: add hardware hints capability to  the driver Netanel Belgazal <netanel@annapurnalabs.com> - 2016-12-05 19:40 +0100
  [PATCH V2 net 17/20] net/ena: add IPv6 extended protocols to ena_admin_flow_hash_proto Netanel Belgazal <netanel@annapurnalabs.com> - 2016-12-04 14:30 +0100
  [PATCH V2 net 09/20] net/ena: fix potential access to freed memory during device reset Netanel Belgazal <netanel@annapurnalabs.com> - 2016-12-04 14:30 +0100
  [PATCH V2 net 07/20] net/ena: refactor ena_get_stats64 to be atomic context safe Netanel Belgazal <netanel@annapurnalabs.com> - 2016-12-04 14:30 +0100
    Re: [PATCH V2 net 07/20] net/ena: refactor ena_get_stats64 to be  atomic context safe Matt Wilson <msw@amzn.com> - 2016-12-05 05:30 +0100
      Re: [PATCH V2 net 07/20] net/ena: refactor ena_get_stats64 to be  atomic context safe Netanel Belgazal <netanel@annapurnalabs.com> - 2016-12-05 19:40 +0100
  [PATCH V2 net 12/20] net/ena: reduce the severity of ena printouts Netanel Belgazal <netanel@annapurnalabs.com> - 2016-12-04 14:30 +0100
  [PATCH V2 net 16/20] net/ena: use napi_schedule_irqoff when possible Netanel Belgazal <netanel@annapurnalabs.com> - 2016-12-04 14:30 +0100
  [PATCH V2 net 11/20] net/ena: use READ_ONCE to access completion descriptors Netanel Belgazal <netanel@annapurnalabs.com> - 2016-12-04 14:30 +0100
  [PATCH V2 net 06/20] net/ena: fix NULL dereference when removing the driver after device reset faild Netanel Belgazal <netanel@annapurnalabs.com> - 2016-12-04 14:30 +0100
    Re: [PATCH V2 net 06/20] net/ena: fix NULL dereference when removing  the driver after device reset faild Matt Wilson <msw@amzn.com> - 2016-12-05 05:40 +0100
      Re: [PATCH V2 net 06/20] net/ena: fix NULL dereference when removing  the driver after device reset faild Netanel Belgazal <netanel@annapurnalabs.com> - 2016-12-05 19:40 +0100
  [PATCH V2 net 14/20] net/ena: change condition for host attribute configuration Netanel Belgazal <netanel@annapurnalabs.com> - 2016-12-04 14:30 +0100
  [PATCH V2 net 04/20] net/ena: fix ethtool RSS flow configuration Netanel Belgazal <netanel@annapurnalabs.com> - 2016-12-04 14:30 +0100
    Re: [PATCH V2 net 04/20] net/ena: fix ethtool RSS flow configuration Matt Wilson <msw@amzn.com> - 2016-12-05 05:20 +0100
      Re: [PATCH V2 net 04/20] net/ena: fix ethtool RSS flow configuration Netanel Belgazal <netanel@annapurnalabs.com> - 2016-12-05 19:30 +0100
  [PATCH V2 net 02/20] net/ena: fix error handling when probe fails Netanel Belgazal <netanel@annapurnalabs.com> - 2016-12-04 14:30 +0100
    Re: [PATCH V2 net 02/20] net/ena: fix error handling when probe fails Matt Wilson <msw@amzn.com> - 2016-12-05 05:20 +0100
      Re: [PATCH V2 net 02/20] net/ena: fix error handling when probe fails Netanel Belgazal <netanel@annapurnalabs.com> - 2016-12-05 19:30 +0100
  [PATCH V2 net 10/20] net/ena: remove redundant logic in napi callback for busy poll mode Netanel Belgazal <netanel@annapurnalabs.com> - 2016-12-04 14:30 +0100
    Re: [PATCH V2 net 10/20] net/ena: remove redundant logic in napi  callback for busy poll mode Eric Dumazet <eric.dumazet@gmail.com> - 2016-12-05 07:00 +0100
      Re: [PATCH V2 net 10/20] net/ena: remove redundant logic in napi  callback for busy poll mode Netanel Belgazal <netanel@annapurnalabs.com> - 2016-12-05 19:30 +0100
        Re: [PATCH V2 net 10/20] net/ena: remove redundant logic in napi  callback for busy poll mode Eric Dumazet <eric.dumazet@gmail.com> - 2016-12-05 20:00 +0100
  [PATCH V2 net 15/20] net/ena: change sizeof() argument to be the type pointer Netanel Belgazal <netanel@annapurnalabs.com> - 2016-12-04 14:30 +0100
  [PATCH V2 net 01/20] net/ena: remove ntuple filter support from device feature list Netanel Belgazal <netanel@annapurnalabs.com> - 2016-12-04 14:30 +0100
    Re: [PATCH V2 net 01/20] net/ena: remove ntuple filter support from  device feature list Matt Wilson <msw@amzn.com> - 2016-12-05 05:10 +0100
  [PATCH V2 net 19/20] net/ena: restructure skb allocation Netanel Belgazal <netanel@annapurnalabs.com> - 2016-12-04 14:30 +0100
  [PATCH V2 net 03/20] net/ena: fix queues number calculation Netanel Belgazal <netanel@annapurnalabs.com> - 2016-12-04 14:30 +0100
    Re: [PATCH V2 net 03/20] net/ena: fix queues number calculation Matt Wilson <msw@amzn.com> - 2016-12-05 05:20 +0100
      Re: [PATCH V2 net 03/20] net/ena: fix queues number calculation Netanel Belgazal <netanel@annapurnalabs.com> - 2016-12-05 19:30 +0100
  Re: [PATCH V2 net 00/20] Increase ENA driver version to 1.1.2 David Miller <davem@davemloft.net> - 2016-12-05 03:50 +0100
    Re: [PATCH V2 net 00/20] Increase ENA driver version to 1.1.2 Matt Wilson <msw@amzn.com> - 2016-12-05 04:40 +0100

csiph-web