linux-ia64.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Geyslan G. Bem" <geyslan@gmail.com>
To: peter.senna@gmail.com, jg.victorino1@gmail.com, raphaelscarv@gmail.com
Cc: "Geyslan G. Bem" <geyslan@gmail.com>,
	Tony Luck <tony.luck@intel.com>,
	Fenghua Yu <fenghua.yu@intel.com>,
	linux-ia64@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v2] ia64: bitvector_process could read out of bounds
Date: Wed, 02 Dec 2015 20:00:10 +0000	[thread overview]
Message-ID: <1449086412-3540-1-git-send-email-geyslan@gmail.com> (raw)

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


                 reply	other threads:[~2015-12-02 20:00 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1449086412-3540-1-git-send-email-geyslan@gmail.com \
    --to=geyslan@gmail.com \
    --cc=fenghua.yu@intel.com \
    --cc=jg.victorino1@gmail.com \
    --cc=linux-ia64@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peter.senna@gmail.com \
    --cc=raphaelscarv@gmail.com \
    --cc=tony.luck@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).