From patchwork Sat Sep 30 00:34:46 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Smart X-Patchwork-Id: 9978887 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 45F886037F for ; Sat, 30 Sep 2017 00:35:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 39344298D1 for ; Sat, 30 Sep 2017 00:35:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2E145298D5; Sat, 30 Sep 2017 00:35:21 +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.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM 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 D8A4B298D1 for ; Sat, 30 Sep 2017 00:35:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752657AbdI3AfR (ORCPT ); Fri, 29 Sep 2017 20:35:17 -0400 Received: from mail-qt0-f196.google.com ([209.85.216.196]:51494 "EHLO mail-qt0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752650AbdI3AfP (ORCPT ); Fri, 29 Sep 2017 20:35:15 -0400 Received: by mail-qt0-f196.google.com with SMTP id q4so1597539qtq.8 for ; Fri, 29 Sep 2017 17:35:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=fdF2hWyJ3VMpWOyIzvd2rrSfQyD8b3Ou309rB5IJH30=; b=fpgmjN/iI6VkBBs+XPvv1zoH+DqAptWWjQoO0VErWolNhOMSWRcrYDjYu5KXMGpWhJ soenNY3IBSgdHLzQ0X7af5jWjI/8aEAgL773TVI5LxAJjV+dI0CrhOHULK7v6/mcG+jI Y4tZN6vyRlmH3WCoFR10ZWdHa83Nh1J0b1hdhuRhW4iq+y27AYObrNHeJvI/Zps9bpRf /59LW5E+dMgRuC3GrjPrN6jPo9yFH77VabOm93kO0+KZ77s9sFVI3ry8j/G31k83/2PG AmOi2gZOcSGMuTw9Id96V9iIHVQRB4Jh0ruEWeQqcJssmX45JCbGmeBFtHUQac8uFD2c IwPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=fdF2hWyJ3VMpWOyIzvd2rrSfQyD8b3Ou309rB5IJH30=; b=RNNoFBjS8y5JRf759OVCpXu0xxPa9Tl/B3Hub+Kh2Z8DxCbupQI8Hz4ZhwESYDk1R1 3o06+iNbbJfnRM9M81/swkD4CReX8eDN4Ur+LW2/gAwVjedV2HVN7dlkEFgaFD42xO/F 0LJa+djbuYWF+6lGGUeGf9/BnmKvGS2DXLktqD9mEUjUYZxprolaIeoGlNuwf+B626xi xchTlEongQJJRrRhaVQ+Uerebdyzo8/9MNwYaxgfFbhVvEEFn2yZ+kAl+P2I489zuNpy 4TxBOGYHlXLT/Q5qmDAvRekZ3El2zDBWaMAv7EMuMdl3O4xf3FgJP4zYxg21+odgzShN 2MIQ== X-Gm-Message-State: AMCzsaUN0bciVtgUBcePJvpaMD4YkuMW63eZb03dOmYcTckIztzOxkji GXJLca0aS4N5c786B6DIKAvtwg== X-Google-Smtp-Source: AOwi7QCNqKH3XPdDJJr/Rm7SZH4W/rXfh0X3jONP1H9+N2Kuw91kKTCuvUolZ24oUwnOJdosAjP5SQ== X-Received: by 10.200.20.136 with SMTP id l8mr8797264qtj.98.1506731714221; Fri, 29 Sep 2017 17:35:14 -0700 (PDT) Received: from pallmd1.broadcom.com ([192.19.255.250]) by smtp.gmail.com with ESMTPSA id u32sm3596918qte.25.2017.09.29.17.35.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 29 Sep 2017 17:35:13 -0700 (PDT) From: James Smart To: linux-scsi@vger.kernel.org Cc: James Smart , Dick Kennedy , James Smart Subject: [PATCH v2 20/21] lpfc: correct nvme sg segment count check Date: Fri, 29 Sep 2017 17:34:46 -0700 Message-Id: <20170930003447.10747-21-jsmart2021@gmail.com> X-Mailer: git-send-email 2.13.1 In-Reply-To: <20170930003447.10747-1-jsmart2021@gmail.com> References: <20170930003447.10747-1-jsmart2021@gmail.com> Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The internal cfg flag is actually smaller, by 1 (for a partial page sge), than the sg list maintained by the driver. Thus the check on sg segments errored out when it shouldn't have Ensure the check is +1 Note: having a value that is less than what it really is is bogus. Correcting it now would be a significant rework. Add this item to the list to be refactored in the merge with efct. Signed-off-by: Dick Kennedy Signed-off-by: James Smart Reviewed-by: Johannes Thumshirn --- drivers/scsi/lpfc/lpfc_nvme.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc_nvme.c b/drivers/scsi/lpfc/lpfc_nvme.c index 040af28073bb..05ab731c408a 100644 --- a/drivers/scsi/lpfc/lpfc_nvme.c +++ b/drivers/scsi/lpfc/lpfc_nvme.c @@ -1149,12 +1149,12 @@ lpfc_nvme_prep_io_dma(struct lpfc_vport *vport, first_data_sgl = sgl; lpfc_ncmd->seg_cnt = nCmd->sg_cnt; - if (lpfc_ncmd->seg_cnt > phba->cfg_nvme_seg_cnt) { + if (lpfc_ncmd->seg_cnt > phba->cfg_nvme_seg_cnt + 1) { lpfc_printf_log(phba, KERN_ERR, LOG_NVME_IOERR, "6058 Too many sg segments from " "NVME Transport. Max %d, " "nvmeIO sg_cnt %d\n", - phba->cfg_nvme_seg_cnt, + phba->cfg_nvme_seg_cnt + 1, lpfc_ncmd->seg_cnt); lpfc_ncmd->seg_cnt = 0; return 1;