lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210723231957.1113800-1-bcf@google.com>
Date:   Fri, 23 Jul 2021 16:19:57 -0700
From:   Bailey Forrest <bcf@...gle.com>
To:     Bailey Forrest <bcf@...gle.com>,
        "David S . Miller" <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>,
        Arnd Bergmann <arnd@...nel.org>
Cc:     netdev@...r.kernel.org
Subject: [PATCH net] gve: DQO: Suppress unused var warnings

Some variables become unused when `CONFIG_NEED_DMA_MAP_STATE=n`.

We only suppress when `CONFIG_NEED_DMA_MAP_STATE=n` in order to avoid
false negatives.

Fixes: a57e5de476be ("gve: DQO: Add TX path")
Signed-off-by: Bailey Forrest <bcf@...gle.com>
---
 drivers/net/ethernet/google/gve/gve_tx_dqo.c | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/google/gve/gve_tx_dqo.c b/drivers/net/ethernet/google/gve/gve_tx_dqo.c
index 05ddb6a75c38..f873321c022e 100644
--- a/drivers/net/ethernet/google/gve/gve_tx_dqo.c
+++ b/drivers/net/ethernet/google/gve/gve_tx_dqo.c
@@ -87,6 +87,9 @@ static void gve_tx_clean_pending_packets(struct gve_tx_ring *tx)
 		for (j = 0; j < cur_state->num_bufs; j++) {
 			struct gve_tx_dma_buf *buf = &cur_state->bufs[j];
 
+#ifndef CONFIG_NEED_DMA_MAP_STATE
+			(void)buf;  // Suppress unused variable.
+#endif
 			if (j == 0) {
 				dma_unmap_single(tx->dev,
 						 dma_unmap_addr(buf, dma),
@@ -459,9 +462,14 @@ static int gve_tx_add_skb_no_copy_dqo(struct gve_tx_ring *tx,
 
 	struct gve_tx_pending_packet_dqo *pending_packet;
 	struct gve_tx_metadata_dqo metadata;
+	struct gve_tx_dma_buf *buf;
 	s16 completion_tag;
 	int i;
 
+#ifndef CONFIG_NEED_DMA_MAP_STATE
+	(void)buf;  // Suppress unused variable.
+#endif
+
 	pending_packet = gve_alloc_pending_packet(tx);
 	pending_packet->skb = skb;
 	pending_packet->num_bufs = 0;
@@ -493,8 +501,6 @@ static int gve_tx_add_skb_no_copy_dqo(struct gve_tx_ring *tx,
 
 	/* Map the linear portion of skb */
 	{
-		struct gve_tx_dma_buf *buf =
-			&pending_packet->bufs[pending_packet->num_bufs];
 		u32 len = skb_headlen(skb);
 		dma_addr_t addr;
 
@@ -502,6 +508,7 @@ static int gve_tx_add_skb_no_copy_dqo(struct gve_tx_ring *tx,
 		if (unlikely(dma_mapping_error(tx->dev, addr)))
 			goto err;
 
+		buf = &pending_packet->bufs[pending_packet->num_bufs];
 		dma_unmap_len_set(buf, len, len);
 		dma_unmap_addr_set(buf, dma, addr);
 		++pending_packet->num_bufs;
@@ -512,8 +519,6 @@ static int gve_tx_add_skb_no_copy_dqo(struct gve_tx_ring *tx,
 	}
 
 	for (i = 0; i < shinfo->nr_frags; i++) {
-		struct gve_tx_dma_buf *buf =
-			&pending_packet->bufs[pending_packet->num_bufs];
 		const skb_frag_t *frag = &shinfo->frags[i];
 		bool is_eop = i == (shinfo->nr_frags - 1);
 		u32 len = skb_frag_size(frag);
@@ -523,6 +528,7 @@ static int gve_tx_add_skb_no_copy_dqo(struct gve_tx_ring *tx,
 		if (unlikely(dma_mapping_error(tx->dev, addr)))
 			goto err;
 
+		buf = &pending_packet->bufs[pending_packet->num_bufs];
 		dma_unmap_len_set(buf, len, len);
 		dma_unmap_addr_set(buf, dma, addr);
 		++pending_packet->num_bufs;
@@ -555,6 +561,9 @@ static int gve_tx_add_skb_no_copy_dqo(struct gve_tx_ring *tx,
 	for (i = 0; i < pending_packet->num_bufs; i++) {
 		struct gve_tx_dma_buf *buf = &pending_packet->bufs[i];
 
+#ifndef CONFIG_NEED_DMA_MAP_STATE
+		(void)buf;  // Suppress unused variable.
+#endif
 		if (i == 0) {
 			dma_unmap_single(tx->dev, dma_unmap_addr(buf, dma),
 					 dma_unmap_len(buf, len),
-- 
2.32.0.432.gabb21c7263-goog

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ