alpha: silence a buffer overflow warning
authorDan Carpenter <dan.carpenter@oracle.com>
Mon, 14 Nov 2016 11:34:00 +0000 (14:34 +0300)
committerMatt Turner <mattst88@gmail.com>
Mon, 4 Sep 2017 19:04:32 +0000 (12:04 -0700)
We check that "member" is in bounds for the first line, but we also use
it on the next line without checking which is a mistake.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Matt Turner <mattst88@gmail.com>
arch/alpha/kernel/setup.c

index 491e6a604e82ac468ffc1e2212080fd381f894c8..249229ab49424fcefb9d38830280b81151a7a9db 100644 (file)
@@ -1094,8 +1094,9 @@ get_sysnames(unsigned long type, unsigned long variation, unsigned long cpu,
        default: /* default to variation "0" for now */
                break;
        case ST_DEC_EB164:
-               if (member < ARRAY_SIZE(eb164_indices))
-                       *variation_name = eb164_names[eb164_indices[member]];
+               if (member >= ARRAY_SIZE(eb164_indices))
+                       break;
+               *variation_name = eb164_names[eb164_indices[member]];
                /* PC164 may show as EB164 variation, but with EV56 CPU,
                   so, since no true EB164 had anything but EV5... */
                if (eb164_indices[member] == 0 && cpu == EV56_CPU)