# HG changeset patch # User kaf24@firebug.cl.cam.ac.uk # Date 1163667418 0 # Node ID ba84d697b1eafe46f357f9498a8e7c823f44c69d # Parent b276ed52616aa89b12e6cbb2f8c3e21cddfefb97 [NET] back: Fix bug in 12262:ac2097d71e06dbbf77279af10d6ae7359d921ab0. Pointed out by Jan Beulich. Signed-off-by: Keir Fraser diff -r b276ed52616a -r ba84d697b1ea linux-2.6-xen-sparse/drivers/xen/netback/netback.c --- a/linux-2.6-xen-sparse/drivers/xen/netback/netback.c Thu Nov 16 07:48:37 2006 +0000 +++ b/linux-2.6-xen-sparse/drivers/xen/netback/netback.c Thu Nov 16 08:56:58 2006 +0000 @@ -825,7 +825,9 @@ static void tx_add_credit(netif_t *netif max_burst = max(max_burst, netif->credit_bytes); /* Take care that adding a new chunk of credit doesn't wrap to zero. */ - max_credit = max(netif->remaining_credit + netif->credit_bytes, ~0UL); + max_credit = netif->remaining_credit + netif->credit_bytes; + if (max_credit < netif->remaining_credit) + max_credit = ULONG_MAX; /* wrapped: clamp to ULONG_MAX */ netif->remaining_credit = min(max_credit, max_burst); }