From patchwork Thu Feb 1 10:01:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 10195193 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.web.codeaurora.org (Postfix) with ESMTP id E142E60247 for ; Thu, 1 Feb 2018 10:02:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D9E43287CB for ; Thu, 1 Feb 2018 10:02:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CE19A28885; Thu, 1 Feb 2018 10:02:09 +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=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, 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 2EC24287CB for ; Thu, 1 Feb 2018 10:02:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751522AbeBAKCF (ORCPT ); Thu, 1 Feb 2018 05:02:05 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:40868 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751405AbeBAKCF (ORCPT ); Thu, 1 Feb 2018 05:02:05 -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 w11A1wI9165615; Thu, 1 Feb 2018 10:01:58 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-2017-10-26; bh=j+8Z1jOrcxMvYcaUvIl6Z5y871WU3/G80d3JhMgNG/M=; b=LCsS2obTOo/AMB1+qmkoouNwhHg+UmZwBzYmOGsCHZF1XoYHDUhV3a0l6wz/5Tw9ee3S u+FcOpS2jxQzauitbp/GHuXy+0Hl23ZqjHV/VJmmmKRkjH2uYfwL+/Znzjt+L7B0p/fy pLnVNcgFPHNfofiPiEn3aXdtwG2agdgsxoiLIKu95A7uktfwsKQtc5ArOlRyx8/i/gmY 9GlXl7MbkjF6N7znufWt1RsArp9rPCIagDMKpsy4vLiLgdZ7MT0obMtL6KALjjDFKO13 Ktv7pnLBc9jXyF0hl9l0bcQkgabqDAKvcA9qXe4YbYPMuG9/kDbDF8UDbNX25beJdaG5 UA== Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by userp2120.oracle.com with ESMTP id 2fuqnt9pea-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 01 Feb 2018 10:01:58 +0000 Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w11A1vYM002847 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 1 Feb 2018 10:01:57 GMT Received: from abhmp0016.oracle.com (abhmp0016.oracle.com [141.146.116.22]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w11A1u2G012394; Thu, 1 Feb 2018 10:01:56 GMT Received: from mwanda (/41.202.241.60) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 01 Feb 2018 02:01:55 -0800 Date: Thu, 1 Feb 2018 13:01:48 +0300 From: Dan Carpenter To: Doug Ledford , Leon Romanovsky Cc: Jason Gunthorpe , Steve Wise , Mark Bloch , linux-rdma@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH] RDMA/nldev: missing error code in nldev_res_get_doit() Message-ID: <20180201100148.GA8959@mwanda> MIME-Version: 1.0 Content-Disposition: inline X-Mailer: git-send-email haha only kidding User-Agent: Mutt/1.9.2 (2017-12-15) X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8791 signatures=668659 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1802010131 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 We should return -ENOMEM if the allocation fails. The current code accidentally returns success. Fixes: bf3c5a93c523 ("RDMA/nldev: Provide global resource utilization") Signed-off-by: Dan Carpenter Reviewed-by: Leon Romanovsky --- To unsubscribe from this list: send the line "unsubscribe linux-rdma" 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/drivers/infiniband/core/nldev.c b/drivers/infiniband/core/nldev.c index fa8655e3b3ed..5326a684555f 100644 --- a/drivers/infiniband/core/nldev.c +++ b/drivers/infiniband/core/nldev.c @@ -499,8 +499,10 @@ static int nldev_res_get_doit(struct sk_buff *skb, struct nlmsghdr *nlh, return -EINVAL; msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); - if (!msg) + if (!msg) { + ret = -ENOMEM; goto err; + } nlh = nlmsg_put(msg, NETLINK_CB(skb).portid, nlh->nlmsg_seq, RDMA_NL_GET_TYPE(RDMA_NL_NLDEV, RDMA_NLDEV_CMD_RES_GET),