From patchwork Sat Dec 22 07:42:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 10741351 X-Patchwork-Delegate: jgg@ziepe.ca Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2E3E81399 for ; Sat, 22 Dec 2018 16:57:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1A978288BB for ; Sat, 22 Dec 2018 16:57:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0D7A328A15; Sat, 22 Dec 2018 16:57:17 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A6F1C288BB for ; Sat, 22 Dec 2018 16:57:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730989AbeLVQ5Q (ORCPT ); Sat, 22 Dec 2018 11:57:16 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:54342 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730441AbeLVQ5Q (ORCPT ); Sat, 22 Dec 2018 11:57:16 -0500 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id wBM7cnri151319; Sat, 22 Dec 2018 07:43:12 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : mime-version : content-type; s=corp-2018-07-02; bh=hP28bD5hTNcLQCwIjLWQN6n3KXnx8hzX09cGJkKZTig=; b=PMGvockBAotFsox67K293YLDvrDuwDBpUYt0NYvCixOdFlN3j3T/G1E3hvZbhkrKwadl ZV1x6N7pzOb8jsVJJGBPbzriin/pFGphyCuq86tqvqg3dGh2o8TddD+pPIRpPiHof+di Mp5Kj2IsH7dXr3pFcmUaBsKzNrROurHR6qMTfOVWy2tcmYYIZrJGJYYFJ05bfSnQG/fk /KbIbIrLcImc0980gNWBZS0/6kLAySaz27lSoVadymnxKaFxZZhc2FkNH0qyGKtzskZD rJDdiusBWjWQW5TCFk6gOBPL2d1twUWlu6LVBYB1X4LXBA2ZvHEmOOwSCjnaHFP0ZizP CA== Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by userp2120.oracle.com with ESMTP id 2phdwqg6vn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 22 Dec 2018 07:43:11 +0000 Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id wBM7hA7T019689 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 22 Dec 2018 07:43:11 GMT Received: from abhmp0014.oracle.com (abhmp0014.oracle.com [141.146.116.20]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id wBM7h9nu004679; Sat, 22 Dec 2018 07:43:09 GMT Received: from kadam (/197.157.0.27) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 21 Dec 2018 23:43:09 -0800 Date: Sat, 22 Dec 2018 10:42:59 +0300 From: Dan Carpenter To: Doug Ledford , Moni Shoua Cc: Jason Gunthorpe , Leon Romanovsky , Parav Pandit , Ariel Levkovich , Kamal Heib , linux-rdma@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH] IB/uverbs: Signedness bug in UVERBS_HANDLER() Message-ID: <20181222074259.GA6338@kadam> MIME-Version: 1.0 Content-Disposition: inline X-Mailer: git-send-email haha only kidding User-Agent: Mutt/1.9.4 (2018-02-28) X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9114 signatures=668680 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=704 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1812220069 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The "num_sge" variable needs to be signed for the error handling to work. The uverbs_attr_ptr_get_array_size() returns int so this change is safe. Fixes: ad8a4496757f ("IB/uverbs: Add support to advise_mr") Signed-off-by: Dan Carpenter Reviewed-by: Leon Romanovsky --- drivers/infiniband/core/uverbs_std_types_mr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/infiniband/core/uverbs_std_types_mr.c b/drivers/infiniband/core/uverbs_std_types_mr.c index 71dfa5e5938e..4d4be0c2b752 100644 --- a/drivers/infiniband/core/uverbs_std_types_mr.c +++ b/drivers/infiniband/core/uverbs_std_types_mr.c @@ -47,7 +47,7 @@ static int UVERBS_HANDLER(UVERBS_METHOD_ADVISE_MR)( enum ib_uverbs_advise_mr_advice advice; struct ib_device *ib_dev = pd->device; struct ib_sge *sg_list; - u32 num_sge; + int num_sge; u32 flags; int ret;