]> Pileus Git - ~andy/linux/blobdiff - drivers/tty/n_gsm.c
tty: Always handle NULL flag ptr
[~andy/linux] / drivers / tty / n_gsm.c
index c0f76da553042db2f3eadb91cfb9ff08bc60e43d..c09db11b8831d8b9f5b8b05413e0907a46ba1299 100644 (file)
@@ -2269,14 +2269,15 @@ static void gsmld_receive_buf(struct tty_struct *tty, const unsigned char *cp,
        char *f;
        int i;
        char buf[64];
-       char flags;
+       char flags = TTY_NORMAL;
 
        if (debug & 4)
                print_hex_dump_bytes("gsmld_receive: ", DUMP_PREFIX_OFFSET,
                                     cp, count);
 
        for (i = count, dp = cp, f = fp; i; i--, dp++) {
-               flags = *f++;
+               if (f)
+                       flags = *f++;
                switch (flags) {
                case TTY_NORMAL:
                        gsm->receive(gsm, *dp);