]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
amd64_edac:__amd64_set_scrub_rate(): avoid overindexing scrubrates[]
authorAndrew Morton <akpm@linux-foundation.org>
Tue, 23 Oct 2012 21:09:39 +0000 (14:09 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 28 Oct 2012 17:14:15 +0000 (10:14 -0700)
commit8538f9c30a098c87bb806e80f43b2203a997a4d9
treea4a23e993f7f401dcd15b2948da36f090557bf39
parent5a58f4890e681eadbb617cace87cfdac948c7edd
amd64_edac:__amd64_set_scrub_rate(): avoid overindexing scrubrates[]

commit 168bfeef7bba3f9784f7540b053e4ac72b769ce9 upstream.

If none of the elements in scrubrates[] matches, this loop will cause
__amd64_set_scrub_rate() to incorrectly use the n+1th element.

As the function is designed to use the final scrubrates[] element in the
case of no match, we can fix this bug by simply terminating the array
search at the n-1th element.

Boris: this code is fragile anyway, see here why:
http://marc.info/?l=linux-kernel&m=135102834131236&w=2

It will be rewritten more robustly soonish.

Reported-by: Denis Kirjanov <kirjanov@gmail.com>
Cc: Doug Thompson <dougthompson@xmission.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Borislav Petkov <borislav.petkov@amd.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/edac/amd64_edac.c