Skip to contentSkip to conversation

uml: line.c: avoid NULL pointer dereference

PATCH New Alexander Beregalov 1 participant 1 message Jan 7, 2010 User-mode Linux (UML)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 uml: line.c: avoid NULL pointer dereference

Assign tty only if line is not NULL.

---
 arch/um/drivers/line.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
arch/um/drivers/line.c +4 -2
index cf8a97f..4a46253 100644
@@ -18,10 +18,12 @@ static irqreturn_t line_interrupt(int irq, void *data)
 {
 	struct chan *chan = data;
 	struct line *line = chan->line;
-	struct tty_struct *tty = line->tty;
+	struct tty_struct *tty;
 
-	if (line)
+	if (line) {
+		tty = line->tty;
 		chan_interrupt(&line->chan_list, &line->task, tty, irq);
+	}
 	return IRQ_HANDLED;
 }
 
Signature · 1 line
1.6.6