Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1282279 > unrolled thread

[PATCH] ia64: bitvector_process could read out of bounds

Started by"Geyslan G. Bem" <geyslan@gmail.com>
First post2015-12-02 20:10 +0100
Last post2015-12-07 11:10 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] ia64: bitvector_process could read out of bounds "Geyslan G. Bem" <geyslan@gmail.com> - 2015-12-02 20:10 +0100
    Re: [PATCH] ia64: bitvector_process could read out of bounds Peter Senna Tschudin <peter.senna@gmail.com> - 2015-12-07 11:10 +0100

#1282279 — [PATCH] ia64: bitvector_process could read out of bounds

From"Geyslan G. Bem" <geyslan@gmail.com>
Date2015-12-02 20:10 +0100
Subject[PATCH] ia64: bitvector_process could read out of bounds
Message-ID<qBkWT-2Tg-35@gated-at.bofh.it>
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.

Catched 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..160aba1 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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1285169

FromPeter Senna Tschudin <peter.senna@gmail.com>
Date2015-12-07 11:10 +0100
Message-ID<qD0U3-37l-9@gated-at.bofh.it>
In reply to#1282279
On Wed, Dec 2, 2015 at 8:07 PM, Geyslan G. Bem <geyslan@gmail.com> wrote:
> 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.

I would mention that you also fix some white space issues, but other than that:

Acked-by: Peter Senna Tschudin <peter.senna@gmail.com>
>
> Catched 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..160aba1 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
>



-- 
Peter
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web