From patchwork Wed Mar 26 15:05:11 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yann Droneaud X-Patchwork-Id: 3893991 Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 2E8C29F375 for ; Wed, 26 Mar 2014 15:05:57 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 267FE2021F for ; Wed, 26 Mar 2014 15:05:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9B95C20221 for ; Wed, 26 Mar 2014 15:05:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751803AbaCZPFx (ORCPT ); Wed, 26 Mar 2014 11:05:53 -0400 Received: from smtp3-g21.free.fr ([212.27.42.3]:49804 "EHLO smtp3-g21.free.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750956AbaCZPFx (ORCPT ); Wed, 26 Mar 2014 11:05:53 -0400 Received: from localhost.localdomain (unknown [37.160.32.185]) by smtp3-g21.free.fr (Postfix) with ESMTP id 78820A624B; Wed, 26 Mar 2014 16:05:43 +0100 (CET) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by localhost.localdomain (8.14.8/8.14.7) with ESMTP id s2QF5YM0029329; Wed, 26 Mar 2014 16:05:35 +0100 Received: (from ydroneaud@localhost) by localhost.localdomain (8.14.8/8.14.8/Submit) id s2QF5QSE029327; Wed, 26 Mar 2014 16:05:26 +0100 From: Yann Droneaud To: Roland Dreier , Roland Dreier Cc: Yann Droneaud , linux-rdma@vger.kernel.org, Steve Wise , Steve Wise Subject: [PATCH] RDMA/cxgb4: set error code on kmalloc() failure Date: Wed, 26 Mar 2014 16:05:11 +0100 Message-Id: <1395846311-29288-1-git-send-email-ydroneaud@opteya.com> X-Mailer: git-send-email 1.9.0 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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 If kmalloc() fails in c4iw_alloc_ucontext(), the function leaves but does not set an error code in ret variable: it will return 0 to the caller. This patch set ret to -ENOMEM in such case. Cc: Steve Wise Cc: Steve Wise Signed-off-by: Yann Droneaud --- drivers/infiniband/hw/cxgb4/provider.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/infiniband/hw/cxgb4/provider.c b/drivers/infiniband/hw/cxgb4/provider.c index e36d2a27c431..79429256023a 100644 --- a/drivers/infiniband/hw/cxgb4/provider.c +++ b/drivers/infiniband/hw/cxgb4/provider.c @@ -128,8 +128,10 @@ static struct ib_ucontext *c4iw_alloc_ucontext(struct ib_device *ibdev, rhp->rdev.flags |= T4_STATUS_PAGE_DISABLED; } else { mm = kmalloc(sizeof(*mm), GFP_KERNEL); - if (!mm) + if (!mm) { + ret = -ENOMEM; goto err_free; + } uresp.status_page_size = PAGE_SIZE;