Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752526AbcLDGEc (ORCPT ); Sun, 4 Dec 2016 01:04:32 -0500 Received: from m50-132.163.com ([123.125.50.132]:58765 "EHLO m50-132.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751110AbcLDGE3 (ORCPT ); Sun, 4 Dec 2016 01:04:29 -0500 From: Pan Bian To: Narsimhulu Musini , Sesidhar Baddela , "James E.J. Bottomley" , "Martin K. Petersen" , linux-scsi@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Pan Bian Subject: [PATCH 1/1] scsi: snic: fix improper return value Date: Sun, 4 Dec 2016 14:02:41 +0800 Message-Id: <1480831361-5234-1-git-send-email-bianpan201604@163.com> X-Mailer: git-send-email 1.9.1 X-CM-TRANSID: DNGowADH_sqAsUNYfsWwIQ--.64182S3 X-Coremail-Antispam: 1Uf129KBjvdXoW7GF1Dur45GrWxJF45Zw45Awb_yoWDJwb_Wa y0qr13Wr1rJF47G3WftryfJryS9Fy3Wwn2k3W3t34ayF17Za9rJF1ktwn8Zw48XwsFkFyj 9Fn7Xa45AF15GjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7IUYl0P3UUUUU== X-Originating-IP: [114.243.30.33] X-CM-SenderInfo: held01tdqsiiqwquqiywtou0bp/xtbBiAI2+1aDsrQ1RQAAsk Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 934 Lines: 30 From: Pan Bian When the calls to mempool_create_slab_pool() return unexpected values, the value of return variable ret is 0. 0 means no error. Thus, the caller of fnic_probe() cannot detect the error, and may be misled. This patch fixes the bug, assigning "-ENOMEM" to ret before calling mempool_create_slab_pool(). Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=189061 Signed-off-by: Pan Bian --- drivers/scsi/snic/snic_main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/scsi/snic/snic_main.c b/drivers/scsi/snic/snic_main.c index 396b32d..e8907e6 100644 --- a/drivers/scsi/snic/snic_main.c +++ b/drivers/scsi/snic/snic_main.c @@ -586,6 +586,7 @@ for (i = 0; i < SNIC_IO_LOCKS; i++) spin_lock_init(&snic->io_req_lock[i]); + ret = -ENOMEM; pool = mempool_create_slab_pool(2, snic_glob->req_cache[SNIC_REQ_CACHE_DFLT_SGL]); if (!pool) { -- 1.9.1