From: Dan Carpenter Date: Mon, 14 Nov 2016 11:34:00 +0000 (+0300) Subject: alpha: silence a buffer overflow warning X-Git-Tag: v4.14-rc1~153^2~6 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=03e1f04414b6e8ad9dd20081c3f8304e81f28f47;p=platform%2Fkernel%2Flinux-exynos.git alpha: silence a buffer overflow warning 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 Signed-off-by: Matt Turner --- diff --git a/arch/alpha/kernel/setup.c b/arch/alpha/kernel/setup.c index 491e6a6..249229a 100644 --- a/arch/alpha/kernel/setup.c +++ b/arch/alpha/kernel/setup.c @@ -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)