Re: [PATCH v2 12/13] asm-generic: uaccess: 1-byte access is always aligned

Arnd Bergmann
2021-05-15T20:17:49Z

On Sat, May 15, 2021 at 8:41 PM Randy Dunlap <rdunlap@infradead.org> wrote:
> On 5/14/21 3:01 AM, Arnd Bergmann wrote:
> > From: Arnd Bergmann <arnd@arndb.de>
> > diff --git a/include/asm-generic/uaccess.h b/include/asm-generic/uaccess.h
> > index 4973328f3c6e..7e903e450659 100644
> > --- a/include/asm-generic/uaccess.h
> > +++ b/include/asm-generic/uaccess.h
> > @@ -19,7 +19,7 @@ __get_user_fn(size_t size, const void __user *from, void *to)
> >
> > switch (size) {
> > case 1:
> > - *(u8 *)to = get_unaligned((u8 __force *)from);
> > + *(u8 *)to = *((u8 __force *)from);
> > return 0;
> > case 2:
> > *(u16 *)to = get_unaligned((u16 __force *)from);
> > @@ -45,7 +45,7 @@ __put_user_fn(size_t size, void __user *to, void *from)
> >
> > switch (size) {
> > case 1:
> > - put_unaligned(*(u8 *)from, (u8 __force *)to);
> > + *(*(u8 *)from, (u8 __force *)to);
>
> Should that be from =
> ?

Thanks a lot for catching the typo!

Changed now to

*(u8 __force *)to = *(u8 *)from;

For some reason neither my own build testing nor the kernel
build bot caught it so far.

Arnd