[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [linux-2.6.18-xen] netfront: don't truncate grant references
# HG changeset patch # User Jan Beulich <jbeulich@xxxxxxxx> # Date 1478188314 -3600 # Thu Nov 03 16:51:54 2016 +0100 # Node ID 87faef7f0177ac77227628d430c8c7c7e2444dae # Parent 896b47a37cf83c7d204ee2196b8135eeee1dff9d netfront: don't truncate grant references They're of type uint32_t, and hence error checks must not use a more narrow type. Reported-by: Dongli Zhang <dongli.zhang@xxxxxxxxxx> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx> --- diff -r 896b47a37cf8 -r 87faef7f0177 drivers/xen/netfront/netfront.c --- a/drivers/xen/netfront/netfront.c Fri Oct 07 12:05:15 2016 +0200 +++ b/drivers/xen/netfront/netfront.c Thu Nov 03 16:51:54 2016 +0100 @@ -798,7 +798,7 @@ no_skb: np->rx_skbs[id] = skb; ref = gnttab_claim_grant_reference(&np->gref_rx_head); - BUG_ON((signed short)ref < 0); + BUG_ON(IS_ERR_VALUE((int32_t)ref)); np->grant_rx_ref[id] = ref; pfn = page_to_pfn(skb_shinfo(skb)->frags[0].page); @@ -905,7 +905,7 @@ static void xennet_make_frags(struct sk_ tx = RING_GET_REQUEST(&np->tx, prod++); tx->id = id; ref = gnttab_claim_grant_reference(&np->gref_tx_head); - BUG_ON((signed short)ref < 0); + BUG_ON(IS_ERR_VALUE((int32_t)ref)); mfn = virt_to_mfn(data); gnttab_grant_foreign_access_ref(ref, np->xbdev->otherend_id, @@ -927,7 +927,7 @@ static void xennet_make_frags(struct sk_ tx = RING_GET_REQUEST(&np->tx, prod++); tx->id = id; ref = gnttab_claim_grant_reference(&np->gref_tx_head); - BUG_ON((signed short)ref < 0); + BUG_ON(IS_ERR_VALUE((int32_t)ref)); mfn = pfn_to_mfn(page_to_pfn(frag->page)); gnttab_grant_foreign_access_ref(ref, np->xbdev->otherend_id, @@ -1000,7 +1000,7 @@ static int network_start_xmit(struct sk_ tx->id = id; ref = gnttab_claim_grant_reference(&np->gref_tx_head); - BUG_ON((signed short)ref < 0); + BUG_ON(IS_ERR_VALUE((int32_t)ref)); mfn = virt_to_mfn(data); gnttab_grant_foreign_access_ref( ref, np->xbdev->otherend_id, mfn, GTF_readonly); _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxx https://lists.xenproject.org/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |