lkml.org 
[lkml]   [2015]   [Dec]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v2] ia64: bitvector_process could read out of bounds
Date
The units[] array could be accessed out of its bounds due the lack of
verification of the max vector value.

To make this function not prone to error "P" and "E" suffixes were added.
Despite the new suffixes are unrelated to current ia64 vm magnitudes, they
make the code ready for it and avoid misleadings.

Caught using static analysis (cppcheck).

Signed-off-by: Geyslan G. Bem <geyslan@gmail.com>
---
arch/ia64/kernel/palinfo.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/ia64/kernel/palinfo.c b/arch/ia64/kernel/palinfo.c
index c39c3cd..bb499102 100644
--- a/arch/ia64/kernel/palinfo.c
+++ b/arch/ia64/kernel/palinfo.c
@@ -126,7 +126,7 @@ static const char *mem_attrib[]={
static void bitvector_process(struct seq_file *m, u64 vector)
{
int i,j;
- static const char *units[]={ "", "K", "M", "G", "T" };
+ static const char *units[] = { "", "K", "M", "G", "T", "P", "E" };

for (i=0, j=0; i < 64; i++ , j=i/10) {
if (vector & 0x1)
--
2.6.2


\
 
 \ /
  Last update: 2015-12-02 21:21    [W:0.103 / U:0.032 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site