Linux s390 Architecture development
 help / color / mirror / Atom feed
From: Ursula Braun <ubraun@linux.vnet.ibm.com>
To: linux-s390@vger.kernel.org
Subject: Re: [PATCH] s390: wraparound when block_len < 2.
Date: Thu, 05 Mar 2009 11:56:59 +0000	[thread overview]
Message-ID: <1236254219.9845.3.camel@braunu-laptop> (raw)
In-Reply-To: <49AEA2D8.1010408@gmail.com>

Roel,

thanks for your proposal to avoid wrap-arounds in our ctcm receive
code. 
Since the receive code should tolerate any incoming garbage, your patch 
makes our code more robust. I am going to add your ctcm_fsms.c-patch
and 
come up with an additional ctcm_main.c-patch.

Kind regards, Ursula Braun  


Roel Kluin <roel.kluin@gmail.com> wrote on 04.03.2009 16:45:03:

> From:
> 
> Roel Kluin <roel.kluin@gmail.com>
> 
> To:
> 
> Ursula Braun1/Germany/IBM@IBMDE
> 
> Cc:
> 
> linux-s390@vger.kernel.org, Andrew Morton <akpm@linux-foundation.org>
> 
> Date:
> 
> 04.03.2009 16:46
> 
> Subject:
> 
> [PATCH] s390: wraparound when block_len < 2.
> 
> I'm not sure that this is necessary, please review.
>
------------------------------>8-------------8<---------------------------------
> block_len is unsigned so a too large subtraction will cause a
wraparound.
> 
> Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
> ---
> diff --git a/drivers/s390/net/ctcm_fsms.c
b/drivers/s390/net/ctcm_fsms.c
> index f29c708..4ded9ac 100644
> --- a/drivers/s390/net/ctcm_fsms.c
> +++ b/drivers/s390/net/ctcm_fsms.c
> @@ -410,9 +410,8 @@ static void chx_rx(fsm_instance *fi, int event,
void *arg)
>        priv->stats.rx_length_errors++;
>                    goto again;
>     }
> -   block_len -= 2;
> -   if (block_len > 0) {
> -      *((__u16 *)skb->data) = block_len;
> +   if (block_len > 2) {
> +      *((__u16 *)skb->data) = block_len - 2;
>        ctcm_unpack_skb(ch, skb);
>     }
>   again:

           reply	other threads:[~2009-03-05 11:56 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <49AEA2D8.1010408@gmail.com>]

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=1236254219.9845.3.camel@braunu-laptop \
    --to=ubraun@linux.vnet.ibm.com \
    --cc=linux-s390@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