Re: [PATCH] s390: wraparound when block_len < 2.

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

 



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@xxxxxxxxx> wrote on 04.03.2009 16:45:03:

> From:
> 
> Roel Kluin <roel.kluin@xxxxxxxxx>
> 
> To:
> 
> Ursula Braun1/Germany/IBM@IBMDE
> 
> Cc:
> 
> linux-s390@xxxxxxxxxxxxxxx, Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
> 
> 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@xxxxxxxxx>
> ---
> 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:


--
To unsubscribe from this list: send the line "unsubscribe linux-s390" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Kernel Development]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Info]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Linux Media]     [Device Mapper]

  Powered by Linux