From patchwork Fri May 22 14:42:39 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Smart X-Patchwork-Id: 6465171 Return-Path: X-Original-To: patchwork-linux-scsi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 1AB78C0020 for ; Fri, 22 May 2015 14:42:58 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 57E4220160 for ; Fri, 22 May 2015 14:42:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6297B20458 for ; Fri, 22 May 2015 14:42:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757156AbbEVOmv (ORCPT ); Fri, 22 May 2015 10:42:51 -0400 Received: from mail-qg0-f49.google.com ([209.85.192.49]:35792 "EHLO mail-qg0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757024AbbEVOms (ORCPT ); Fri, 22 May 2015 10:42:48 -0400 Received: by qgew3 with SMTP id w3so9073758qge.2 for ; Fri, 22 May 2015 07:42:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:subject:message-id:user-agent :mime-version:content-type:content-transfer-encoding; bh=jQ5f2v4/d6V6H4QP7JLNJpcnohDpzcIyE9cw01ZdwTo=; b=d8hFxzn/husv0qH/m2n/I1cjZdfl+enFWVeNYHS+mDxXuLDSVx45xKxtJF6pPxOPAi uyeJFhtwvI+KoFzPay57X9BjfyHVs4KwnWkthby4ysN8kC6Fhm3BFCq+TEoa8CZ65gZV 65I461WRVHNhuVuqyL6/rtlDultys4xigXi2Opicfu7IUdraPOqZ5LdaQK54aX3IdaiT g4BDdnKzLld/PmviYOP0QL3PcD4FoXuXUE3UDJbePn3alZ9wZkqE1Y6rIsIGT08enUba GGOXK9st78+VLDkAc4GUbYIFzKXRLuIUw7aq4w1Ra1Cop8Y07VPgkFBUY5VTpyXU0LUF AE3g== X-Gm-Message-State: ALoCoQmJS2kH4sd8Yiwuv1n7FoLXlqO8Di/rDk/vK2WEmr4qGwUq+GeL/4ytllavJPlzJL74Cgnt X-Received: by 10.140.238.19 with SMTP id j19mr12070977qhc.87.1432305767802; Fri, 22 May 2015 07:42:47 -0700 (PDT) Received: from myfc17 (c-75-67-235-135.hsd1.nh.comcast.net. [75.67.235.135]) by mx.google.com with ESMTPSA id b141sm1426170qka.11.2015.05.22.07.42.46 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 22 May 2015 07:42:47 -0700 (PDT) Date: Fri, 22 May 2015 10:42:39 -0400 From: james.smart@avagotech.com (James Smart) To: linux-scsi@vger.kernel.org Subject: [PATCH 5/9] lpfc: Fix scsi prep dma buf error. Message-ID: <555f405f.+8s1UhcBRa83wieK%james.smart@avagotech.com> User-Agent: Heirloom mailx 12.5 7/5/10 MIME-Version: 1.0 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_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 Fix scsi prep dma buf error. Didn't check for less-than-or-equal zero. Means we may later call scsi_dma_unmap() even though we don't have valid mappings. Signed-off-by: Dick Kennedy Signed-off-by: James Smart Reviewed-by: Hannes Reinecke --- drivers/scsi/lpfc/lpfc_scsi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c index 4a2a818..b3b195f 100644 --- a/drivers/scsi/lpfc/lpfc_scsi.c +++ b/drivers/scsi/lpfc/lpfc_scsi.c @@ -3257,7 +3257,7 @@ lpfc_scsi_prep_dma_buf_s4(struct lpfc_hba *phba, struct lpfc_scsi_buf *lpfc_cmd) */ nseg = scsi_dma_map(scsi_cmnd); - if (unlikely(!nseg)) + if (unlikely(nseg <= 0)) return 1; sgl += 1; /* clear the last flag in the fcp_rsp map entry */