Skip to contentSkip to conversation

s390: wraparound when block_len < 2.

PATCH Ursula Braun 1 participant 1 message Mar 5, 2009 1 message not in the archive s390

lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive

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 <[email protected]> wrote on 04.03.2009 16:45:03:

Quoted 14 lines

From:

Roel Kluin <[email protected]>

To:

Ursula Braun1/Germany/IBM@IBMDE

Cc:

[email protected], Andrew Morton <[email protected]>

Date:

Quoted 8 lines

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

Quoted 1 line

block_len is unsigned so a too large subtraction will cause a

wraparound.

Review

Quoted 4 lines

---

(quoted diff) +0 -0

b/drivers/s390/net/ctcm_fsms.c

drivers/s390/net/ctcm_fsms.c static void chx_rx(fsm_instance *fi, int event,

Quoted 4 lines

index f29c708..4ded9ac 100644

drivers/s390/net/ctcm_fsms.c +0 -0
@@ -410,9 +410,8 @@ static void chx_rx(fsm_instance *fi, int event,

void *arg)

Quoted 11 lines
drivers/s390/net/ctcm_fsms.c +2 -3
       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: