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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



[Index of Archives]     [Linux Audio Users]     [Linux for Hams]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Fedora Users]

  Powered by Linux