From patchwork Wed Nov 2 01:04:33 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dongli Zhang X-Patchwork-Id: 9408369 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id BFBB660585 for ; Wed, 2 Nov 2016 01:08:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AFA6D29C08 for ; Wed, 2 Nov 2016 01:08:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A33DD29C0E; Wed, 2 Nov 2016 01:08:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3D5D229C08 for ; Wed, 2 Nov 2016 01:08:29 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c1k0F-0001it-1j; Wed, 02 Nov 2016 01:06:07 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c1k0E-0001in-3g for xen-devel@lists.xenproject.org; Wed, 02 Nov 2016 01:06:06 +0000 Received: from [85.158.139.211] by server-3.bemta-5.messagelabs.com id 8F/73-04344-DFB39185; Wed, 02 Nov 2016 01:06:05 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrPLMWRWlGSWpSXmKPExsUyZ7p8oO4fa8k Ig1tLTSy+b5nM5MDocfjDFZYAxijWzLyk/IoE1ozW5iOsBT+4Kl5un8/SwHiLs4uRi0NIYAKT xIf+n+wQzi9GiRnz/7FAOOsZJQ7uaWbrYuQEcroZJXbfMQWx2QR0JKYdOMUCYosIJEjM+f8Cz GYWEJe4ff8pmC0s4C/xd+4SRhCbRUBV4uCV5cwgNq+Au8SpWzOYQGwJATmJm+c6mSFsQ4nPG5 cyT2DkWcDIsIpRvTi1qCy1SNdEL6koMz2jJDcxM0fX0MBULze1uDgxPTUnMalYLzk/dxMj0PM MQLCD8Vaf8yFGSQ4mJVFeVwXJCCG+pPyUyozE4oz4otKc1OJDjBocHAJ9a1ZfYJRiycvPS1WS 4DUBBpiQYFFqempFWmYOMDRhSiU4eJREeJ9aAaV5iwsSc4sz0yFSpxgVpcR5A0H6BEASGaV5c G2weLjEKCslzMsIdJQQT0FqUW5mCar8K0ZxDkYlYd4kkCk8mXklcNNfAS1mAlpsniQBsrgkES El1cC4UuNy3fynXWZ/y8zcfaJWMe3+4np33pFXkYVCV3KDqx20lp01v7J+7botqyykpoZOX+a j1vI7k73z5XPlOU4uZe3dNxJ0nKS8lO701fokqZd8kY2R91z3ju2RRnmTp8mkq+fP3H8RXMZo 8kdyuT7322kVrNviE2N97AW35DB77HSWDJGcx6bEUpyRaKjFXFScCABSx++kggIAAA== X-Env-Sender: dongli.zhang@oracle.com X-Msg-Ref: server-9.tower-206.messagelabs.com!1478048762!68124386!1 X-Originating-IP: [156.151.31.81] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogMTU2LjE1MS4zMS44MSA9PiAyODgzMzk=\n X-StarScan-Received: X-StarScan-Version: 9.0.13; banners=-,-,- X-VirusChecked: Checked Received: (qmail 53587 invoked from network); 2 Nov 2016 01:06:04 -0000 Received: from userp1040.oracle.com (HELO userp1040.oracle.com) (156.151.31.81) by server-9.tower-206.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 2 Nov 2016 01:06:04 -0000 Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id uA2160Iv016635 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 2 Nov 2016 01:06:00 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id uA216097004415 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 2 Nov 2016 01:06:00 GMT Received: from abhmp0003.oracle.com (abhmp0003.oracle.com [141.146.116.9]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id uA215xrS026127; Wed, 2 Nov 2016 01:06:00 GMT Received: from linux.cn.oracle.com (/10.182.70.252) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 01 Nov 2016 18:05:59 -0700 From: Dongli Zhang To: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, xen-devel@lists.xenproject.org Date: Wed, 2 Nov 2016 09:04:33 +0800 Message-Id: <1478048673-26284-1-git-send-email-dongli.zhang@oracle.com> X-Mailer: git-send-email 2.7.4 X-Source-IP: userv0022.oracle.com [156.151.31.74] Cc: davem@davemloft.net Subject: [Xen-devel] [PATCH 1/1] xen-netfront: cast grant table reference first to type int X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP IS_ERR_VALUE() in commit 87557efc27f6a50140fb20df06a917f368ce3c66 ("xen-netfront: do not cast grant table reference to signed short") would not return true for error code unless we cast ref first to type int. Signed-off-by: Dongli Zhang --- drivers/net/xen-netfront.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c index 189a28d..bf2744e 100644 --- a/drivers/net/xen-netfront.c +++ b/drivers/net/xen-netfront.c @@ -304,7 +304,7 @@ static void xennet_alloc_rx_buffers(struct netfront_queue *queue) queue->rx_skbs[id] = skb; ref = gnttab_claim_grant_reference(&queue->gref_rx_head); - WARN_ON_ONCE(IS_ERR_VALUE((unsigned long)ref)); + WARN_ON_ONCE(IS_ERR_VALUE((unsigned long)(int)ref)); queue->grant_rx_ref[id] = ref; page = skb_frag_page(&skb_shinfo(skb)->frags[0]); @@ -428,7 +428,7 @@ static void xennet_tx_setup_grant(unsigned long gfn, unsigned int offset, id = get_id_from_freelist(&queue->tx_skb_freelist, queue->tx_skbs); tx = RING_GET_REQUEST(&queue->tx, queue->tx.req_prod_pvt++); ref = gnttab_claim_grant_reference(&queue->gref_tx_head); - WARN_ON_ONCE(IS_ERR_VALUE((unsigned long)ref)); + WARN_ON_ONCE(IS_ERR_VALUE((unsigned long)(int)ref)); gnttab_grant_foreign_access_ref(ref, queue->info->xbdev->otherend_id, gfn, GNTMAP_readonly);