]> git.baikalelectronics.ru Git - kernel.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)
committerBorislav Petkov <borislav.petkov@amd.com>
Wed, 24 Oct 2012 14:13:27 +0000 (16:13 +0200)
commit82889ed867417d9e6e5b0fd76989eb85023aa082
treea02890616eb3d65377be628ff9cd1b577beb36df
parent6ab66186695d33c81b559545154047cd3436b033
amd64_edac:__amd64_set_scrub_rate(): avoid overindexing scrubrates[]

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: stable@vger.kernel.org
Cc: Doug Thompson <dougthompson@xmission.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Borislav Petkov <borislav.petkov@amd.com>
drivers/edac/amd64_edac.c