From patchwork Sat Dec 22 07:43:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 10741385 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 AE09C1399 for ; Sat, 22 Dec 2018 17:16:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7B36528A1F for ; Sat, 22 Dec 2018 17:16:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6A2A428A24; Sat, 22 Dec 2018 17:16:54 +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 1BBF828A1F for ; Sat, 22 Dec 2018 17:16:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732865AbeLVRQx (ORCPT ); Sat, 22 Dec 2018 12:16:53 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:40602 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725846AbeLVRQx (ORCPT ); Sat, 22 Dec 2018 12:16:53 -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 wBM7dVXq151774; Sat, 22 Dec 2018 07:43:42 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=gXN3FpH0Hw7yhGNGeiwD/fnXxmnKMoNMjtQ8Jc1j9Iw=; b=DKj7Md2NjmtfZvDp1Vg5Eio8Grcq9g3f7l7o9jHFkvqneILd1ZBERz4yXK5ypC2uGns9 70hiEbqpZ9w+C4vdnokrC1g+IGDrRdNde/IogwhHwWRq0KmLI/lwogeA0Wa5dmWK49R/ qyZm8fmoXIUh7/4L5DQbzB9+CJ5wUrIoYUYvRjVF1pyY4gK+BLWYTBpbJvf/DlbOXG4E vWmWXuY/NGntLpnU0YfYBHi1CdVyHnDcLB1LBQknEq6VN976Veb6Ahpnxkskw6C1WJAu 6/QTXYIwM2sWQklTfFlD68Hh9zJUtX3OjmHTLt3SflNCRzTAwWfVZI/y2YhPZLb5hdqW XQ== Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by userp2120.oracle.com with ESMTP id 2phdwqg6vv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 22 Dec 2018 07:43:42 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserv0021.oracle.com (8.14.4/8.14.4) with ESMTP id wBM7hfDB027362 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 22 Dec 2018 07:43:41 GMT Received: from abhmp0009.oracle.com (abhmp0009.oracle.com [141.146.116.15]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id wBM7heIR020853; Sat, 22 Dec 2018 07:43:40 GMT Received: from kadam (/197.157.0.27) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 21 Dec 2018 23:43:40 -0800 Date: Sat, 22 Dec 2018 10:43:32 +0300 From: Dan Carpenter To: Leon Romanovsky , Moni Shoua Cc: Doug Ledford , Jason Gunthorpe , linux-rdma@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH] RDMA/mlx5: Signedness bug in UVERBS_HANDLER() Message-ID: <20181222074332.GA7662@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=970 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_actions" variable needs to be signed for the error handling to work. The maximum number of actions is less than 256 so int type is large enough for that. Fixes: cbfdd442c43e ("IB/uverbs: Add helper to get array size from ptr attribute") Signed-off-by: Dan Carpenter Acked-by: Leon Romanovsky --- drivers/infiniband/hw/mlx5/flow.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/infiniband/hw/mlx5/flow.c b/drivers/infiniband/hw/mlx5/flow.c index 95cf4b9fc65d..e8a1e4498e3f 100644 --- a/drivers/infiniband/hw/mlx5/flow.c +++ b/drivers/infiniband/hw/mlx5/flow.c @@ -329,7 +329,7 @@ static int UVERBS_HANDLER(MLX5_IB_METHOD_FLOW_ACTION_CREATE_MODIFY_HEADER)( struct mlx5_ib_dev *mdev = to_mdev(uobj->context->device); enum mlx5_ib_uapi_flow_table_type ft_type; struct ib_flow_action *action; - size_t num_actions; + int num_actions; void *in; int ret;