All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] m68k/kernel: array out of bound access in process_uboot_commandline
@ 2021-12-28  2:06 Hangyu Hua
  2021-12-28  8:39 ` Geert Uytterhoeven
  0 siblings, 1 reply; 3+ messages in thread
From: Hangyu Hua @ 2021-12-28  2:06 UTC (permalink / raw)
  To: geert; +Cc: linux-m68k, linux-kernel, Hangyu Hua

When the size of commandp >= size, array out of bound write occurs because
len == 0.

Signed-off-by: Hangyu Hua <hbh25y@gmail.com>
---
 arch/m68k/kernel/uboot.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/m68k/kernel/uboot.c b/arch/m68k/kernel/uboot.c
index 928dbd33fc4a..63eaf3c3ddcd 100644
--- a/arch/m68k/kernel/uboot.c
+++ b/arch/m68k/kernel/uboot.c
@@ -101,5 +101,6 @@ __init void process_uboot_commandline(char *commandp, int size)
 	}
 
 	parse_uboot_commandline(commandp, len);
-	commandp[len - 1] = 0;
+	if (len > 0)
+		commandp[len - 1] = 0;
 }
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] m68k/kernel: array out of bound access in process_uboot_commandline
  2021-12-28  2:06 [PATCH v2] m68k/kernel: array out of bound access in process_uboot_commandline Hangyu Hua
@ 2021-12-28  8:39 ` Geert Uytterhoeven
  2022-01-04  2:29   ` Hangyu Hua
  0 siblings, 1 reply; 3+ messages in thread
From: Geert Uytterhoeven @ 2021-12-28  8:39 UTC (permalink / raw)
  To: Hangyu Hua; +Cc: linux-m68k, Linux Kernel Mailing List, Greg Ungerer

CC greg

On Tue, Dec 28, 2021 at 3:06 AM Hangyu Hua <hbh25y@gmail.com> wrote:
>
> When the size of commandp >= size, array out of bound write occurs because
> len == 0.
>
> Signed-off-by: Hangyu Hua <hbh25y@gmail.com>
> ---
>  arch/m68k/kernel/uboot.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/arch/m68k/kernel/uboot.c b/arch/m68k/kernel/uboot.c
> index 928dbd33fc4a..63eaf3c3ddcd 100644
> --- a/arch/m68k/kernel/uboot.c
> +++ b/arch/m68k/kernel/uboot.c
> @@ -101,5 +101,6 @@ __init void process_uboot_commandline(char *commandp, int size)
>         }
>
>         parse_uboot_commandline(commandp, len);
> -       commandp[len - 1] = 0;
> +       if (len > 0)
> +               commandp[len - 1] = 0;
>  }
> --
> 2.25.1

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] m68k/kernel: array out of bound access in process_uboot_commandline
  2021-12-28  8:39 ` Geert Uytterhoeven
@ 2022-01-04  2:29   ` Hangyu Hua
  0 siblings, 0 replies; 3+ messages in thread
From: Hangyu Hua @ 2022-01-04  2:29 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: linux-m68k, Linux Kernel Mailing List, Greg Ungerer, Andreas Schwab

Hi, I think this patch may be forgotten. So I send this e-mail. And I
cc Andreas
who helped me fix the initial version of this patch.

Happy new year.

On Tue, Dec 28, 2021 at 4:40 PM Geert Uytterhoeven <geert@linux-m68k.org> wrote:
>
> CC greg
>
> On Tue, Dec 28, 2021 at 3:06 AM Hangyu Hua <hbh25y@gmail.com> wrote:
> >
> > When the size of commandp >= size, array out of bound write occurs because
> > len == 0.
> >
> > Signed-off-by: Hangyu Hua <hbh25y@gmail.com>
> > ---
> >  arch/m68k/kernel/uboot.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/arch/m68k/kernel/uboot.c b/arch/m68k/kernel/uboot.c
> > index 928dbd33fc4a..63eaf3c3ddcd 100644
> > --- a/arch/m68k/kernel/uboot.c
> > +++ b/arch/m68k/kernel/uboot.c
> > @@ -101,5 +101,6 @@ __init void process_uboot_commandline(char *commandp, int size)
> >         }
> >
> >         parse_uboot_commandline(commandp, len);
> > -       commandp[len - 1] = 0;
> > +       if (len > 0)
> > +               commandp[len - 1] = 0;
> >  }
> > --
> > 2.25.1

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-01-04  2:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-28  2:06 [PATCH v2] m68k/kernel: array out of bound access in process_uboot_commandline Hangyu Hua
2021-12-28  8:39 ` Geert Uytterhoeven
2022-01-04  2:29   ` Hangyu Hua

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.