Re: [PATCH v2] drivers/net/slip: prevent data alignment fault

William Tambe <[email protected]>
Newsgroups gmane.linux.ppp
Message-ID <CAF8i9mOk=F3LY-vUWLMdizBwJXbn2rcRb1Agh_On0O0G3CSCiw@mail.gmail.com>
What additional steps or changes do I need to make for this patch to
make it to mainline ?

On Mon, Oct 2, 2023 at 10:24 AM William Tambe <[email protected]> wrote:
>
> From d30bc4e92236e72bb0a9a743f3ad605ea1c1152e Mon Sep 17 00:00:00 2001
> From: William Tambe <[email protected]>
> Date: Mon, 2 Oct 2023 10:16:54 -0500
> Subject: [PATCH v2] drivers/net/slip: prevent data alignment fault
>
> Prevent data alignment fault on architectures which cannot
> do unaligned memory access.
> ---
>  drivers/net/slip/slhc.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/slip/slhc.c b/drivers/net/slip/slhc.c
> index ba93bab948e0..f198be2c7205 100644
> --- a/drivers/net/slip/slhc.c
> +++ b/drivers/net/slip/slhc.c
> @@ -459,7 +459,7 @@ slhc_compress(struct slcompress *comp, unsigned
> char *icp, int isize,
>          *cpp = ocp;
>          *cp++ = changes;
>      }
> -    *(__sum16 *)cp = csum;
> +    put_unaligned(csum, (__sum16 *)cp);
>      cp += 2;
>  /* deltaS is now the size of the change section of the compressed header */
>      memcpy(cp,new_seq,deltaS);    /* Write list of deltas */
> @@ -534,7 +534,7 @@ slhc_uncompress(struct slcompress *comp, unsigned
> char *icp, int isize)
>      thp = &cs->cs_tcp;
>      ip = &cs->cs_ip;
>
> -    thp->check = *(__sum16 *)cp;
> +    thp->check = get_unaligned((__sum16 *)cp);
>      cp += 2;
>
>      thp->psh = (changes & TCP_PUSH_BIT) ? 1 : 0;
> --
> 2.34.1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.