Skip to contentSkip to conversation

atm: eni: fix uninitialized variable warning

PATCH Applied Arnd Bergmann 2 participants 2 messages Jan 7, 2020 – Jan 8, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 atm: eni: fix uninitialized variable warning

With -O3, gcc has found an actual unintialized variable stored into an mmio register in two instances:

drivers/atm/eni.c: In function 'discard':
drivers/atm/eni.c:465:13: error: 'dma[1]' is used uninitialized in this function [-Werror=uninitialized]

   writel(dma[i*2+1],eni_dev->rx_dma+dma_wr*8+4);
             ^

drivers/atm/eni.c:465:13: error: 'dma[3]' is used uninitialized in this function [-Werror=uninitialized]

Change the code to always write zeroes instead.

---
 drivers/atm/eni.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/atm/eni.c +2 -2
index 8fad56f185ba..17d47ad03ab7 100644
@@ -368,7 +368,7 @@ static int do_rx_dma(struct atm_vcc *vcc,struct sk_buff *skb,
 		here = (eni_vcc->descr+skip) & (eni_vcc->words-1);
 		dma[j++] = (here << MID_DMA_COUNT_SHIFT) | (vcc->vci
 		    << MID_DMA_VCI_SHIFT) | MID_DT_JK;
-		j++;
+		dma[j++] = 0;
 	}
 	here = (eni_vcc->descr+size+skip) & (eni_vcc->words-1);
 	if (!eff) size += skip;
@@ -441,7 +441,7 @@ static int do_rx_dma(struct atm_vcc *vcc,struct sk_buff *skb,
 	if (size != eff) {
 		dma[j++] = (here << MID_DMA_COUNT_SHIFT) |
 		    (vcc->vci << MID_DMA_VCI_SHIFT) | MID_DT_JK;
-		j++;
+		dma[j++] = 0;
 	}
 	if (!j || j > 2*RX_DMA_BUF) {
 		printk(KERN_CRIT DEV_LABEL "!j or j too big!!!\n");
Signature · 1 line
2.20.0
maintainer Applied
#1 lore raw

From: Arnd Bergmann <[email protected]>
Date: Tue, 7 Jan 2020 21:43:59 +0100

Quoted 5 lines

With -O3, gcc has found an actual unintialized variable stored into an mmio register in two instances:

drivers/atm/eni.c: In function 'discard':
drivers/atm/eni.c:465:13: error: 'dma[1]' is used uninitialized in this function [-Werror=uninitialized]

Quoted 7 lines
   writel(dma[i*2+1],eni_dev->rx_dma+dma_wr*8+4);
             ^

drivers/atm/eni.c:465:13: error: 'dma[3]' is used uninitialized in this function [-Werror=uninitialized]

Change the code to always write zeroes instead.

Applied.