linux-ppp.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] drivers/net/slip: prevent data alignment fault
@ 2023-10-02 15:24 William Tambe
  2023-10-30 15:09 ` William Tambe
  0 siblings, 1 reply; 2+ messages in thread
From: William Tambe @ 2023-10-02 15:24 UTC (permalink / raw)
  To: linux-ppp

From d30bc4e92236e72bb0a9a743f3ad605ea1c1152e Mon Sep 17 00:00:00 2001
From: William Tambe <tambewilliam@gmail.com>
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

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

* Re: [PATCH v2] drivers/net/slip: prevent data alignment fault
  2023-10-02 15:24 [PATCH v2] drivers/net/slip: prevent data alignment fault William Tambe
@ 2023-10-30 15:09 ` William Tambe
  0 siblings, 0 replies; 2+ messages in thread
From: William Tambe @ 2023-10-30 15:09 UTC (permalink / raw)
  To: linux-ppp

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 <tambewilliam@gmail.com> wrote:
>
> From d30bc4e92236e72bb0a9a743f3ad605ea1c1152e Mon Sep 17 00:00:00 2001
> From: William Tambe <tambewilliam@gmail.com>
> 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

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

end of thread, other threads:[~2023-10-30 15:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-02 15:24 [PATCH v2] drivers/net/slip: prevent data alignment fault William Tambe
2023-10-30 15:09 ` William Tambe

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).