From: William Tambe <tambewilliam@gmail.com>
To: linux-ppp@vger.kernel.org
Subject: Re: [PATCH] drivers/net/slip: prevent data alignment fault
Date: Sun, 1 Oct 2023 20:10:06 -0500 [thread overview]
Message-ID: <CAF8i9mOo2CRy-jt=q_xDtYqQ6UDsBB=K6ZeGRLxdina-aC=a=Q@mail.gmail.com> (raw)
In-Reply-To: <CAF8i9mP8BeFEubvv8MpuqP-K1okvoJHRb8m1V=JAE33UZrp2_g@mail.gmail.com>
Please, disregard patch, as it is incorrect; resending correct patch
shortly with better explanation of the fix.
On Sun, Oct 1, 2023 at 5:19 PM William Tambe <tambewilliam@gmail.com> wrote:
>
> From c630b0aea59c1dced626c9da95fd71033763d606 Mon Sep 17 00:00:00 2001
> From: William Tambe <tambewilliam@gmail.com>
> Date: Sun, 1 Oct 2023 17:17:03 -0500
> Subject: [PATCH] drivers/net/slip: prevent data alignment fault
>
> ---
> drivers/net/slip/slhc.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/slip/slhc.c b/drivers/net/slip/slhc.c
> index ba93bab948e0..78b07c46fe08 100644
> --- a/drivers/net/slip/slhc.c
> +++ b/drivers/net/slip/slhc.c
> @@ -459,7 +459,8 @@ slhc_compress(struct slcompress *comp, unsigned
> char *icp, int isize,
> *cpp = ocp;
> *cp++ = changes;
> }
> - *(__sum16 *)cp = csum;
> + *cp++ = (char)(csum&0xff);
> + *cp++ = (char)((csum>>8)&0xff);
> 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 +535,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 = (((__sum16)*cp)|(((__sum16)*(cp+1))<<8));
> cp += 2;
>
> thp->psh = (changes & TCP_PUSH_BIT) ? 1 : 0;
> --
> 2.34.1
next prev parent reply other threads:[~2023-10-02 1:10 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-01 22:19 [PATCH] drivers/net/slip: prevent data alignment fault William Tambe
2023-10-02 1:10 ` William Tambe [this message]
-- strict thread matches above, loose matches on Subject: below --
2023-10-02 2:45 William Tambe
2023-10-02 6:31 ` Paul Mackerras
2023-10-02 15:24 ` William Tambe
2023-11-13 1:21 ` Willem de Bruijn
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAF8i9mOo2CRy-jt=q_xDtYqQ6UDsBB=K6ZeGRLxdina-aC=a=Q@mail.gmail.com' \
--to=tambewilliam@gmail.com \
--cc=linux-ppp@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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 read-only IMAP folder(s) and NNTP newsgroup(s).