From patchwork Tue Jan 5 09:50:19 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 7953491 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 330259F1C0 for ; Tue, 5 Jan 2016 09:50:43 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6526A2039E for ; Tue, 5 Jan 2016 09:50:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 830B4202EC for ; Tue, 5 Jan 2016 09:50:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751623AbcAEJuj (ORCPT ); Tue, 5 Jan 2016 04:50:39 -0500 Received: from userp1040.oracle.com ([156.151.31.81]:37210 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751572AbcAEJuh (ORCPT ); Tue, 5 Jan 2016 04:50:37 -0500 Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id u059oUkb030083 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Tue, 5 Jan 2016 09:50:30 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserv0021.oracle.com (8.13.8/8.13.8) with ESMTP id u059oTHV028042 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Tue, 5 Jan 2016 09:50:29 GMT Received: from abhmp0001.oracle.com (abhmp0001.oracle.com [141.146.116.7]) by aserv0122.oracle.com (8.13.8/8.13.8) with ESMTP id u059oTuo032169; Tue, 5 Jan 2016 09:50:29 GMT Received: from mwanda (/154.0.139.178) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 05 Jan 2016 01:50:28 -0800 Date: Tue, 5 Jan 2016 12:50:19 +0300 From: Dan Carpenter To: Trond Myklebust , Chuck Lever Cc: Anna Schumaker , "J. Bruce Fields" , Jeff Layton , linux-nfs@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [patch] svcrdma: signedness bug in xprt_rdma_bc_send_request() Message-ID: <20160105095019.GA23619@mwanda> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) X-Source-IP: aserv0021.oracle.com [141.146.126.233] Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The "len" variable was unsigned so the error handling didn't work. Also "len" was a misleading name because it's either a negative error code or it's zero. It's never actually a length. I've renamed it to "ret". Fixes: eb57be60eca9 ('svcrdma: Add class for RDMA backwards direction transport') Signed-off-by: Dan Carpenter --- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/net/sunrpc/xprtrdma/svc_rdma_backchannel.c b/net/sunrpc/xprtrdma/svc_rdma_backchannel.c index 417cec1..deff06a 100644 --- a/net/sunrpc/xprtrdma/svc_rdma_backchannel.c +++ b/net/sunrpc/xprtrdma/svc_rdma_backchannel.c @@ -240,7 +240,7 @@ xprt_rdma_bc_send_request(struct rpc_task *task) struct rpc_rqst *rqst = task->tk_rqstp; struct svc_xprt *sxprt = rqst->rq_xprt->bc_xprt; struct svcxprt_rdma *rdma; - u32 len; + int ret; dprintk("svcrdma: sending bc call with xid: %08x\n", be32_to_cpu(rqst->rq_xid)); @@ -252,15 +252,15 @@ xprt_rdma_bc_send_request(struct rpc_task *task) rpc_wake_up_queued_task(&sxprt->xpt_bc_pending, task); } - len = -ENOTCONN; + ret = -ENOTCONN; rdma = container_of(sxprt, struct svcxprt_rdma, sc_xprt); if (!test_bit(XPT_DEAD, &sxprt->xpt_flags)) - len = rpcrdma_bc_send_request(rdma, rqst); + ret = rpcrdma_bc_send_request(rdma, rqst); mutex_unlock(&sxprt->xpt_mutex); - if (len < 0) - return len; + if (ret < 0) + return ret; return 0; }