From patchwork Fri Aug 14 20:35:25 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 7019411 Return-Path: X-Original-To: patchwork-linux-scsi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id B041D9F358 for ; Fri, 14 Aug 2015 20:35:56 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D9449206E0 for ; Fri, 14 Aug 2015 20:35:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B97F5206A2 for ; Fri, 14 Aug 2015 20:35:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751513AbbHNUfw (ORCPT ); Fri, 14 Aug 2015 16:35:52 -0400 Received: from aserp1040.oracle.com ([141.146.126.69]:35023 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750735AbbHNUfv (ORCPT ); Fri, 14 Aug 2015 16:35:51 -0400 Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id t7EKZXoF004308 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 14 Aug 2015 20:35:33 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserv0022.oracle.com (8.13.8/8.13.8) with ESMTP id t7EKZWbV028959 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Fri, 14 Aug 2015 20:35:32 GMT Received: from abhmp0012.oracle.com (abhmp0012.oracle.com [141.146.116.18]) by aserv0121.oracle.com (8.13.8/8.13.8) with ESMTP id t7EKZW6m025330; Fri, 14 Aug 2015 20:35:32 GMT Received: from mwanda (/154.0.139.178) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 14 Aug 2015 13:35:31 -0700 Date: Fri, 14 Aug 2015 23:35:25 +0300 From: Dan Carpenter To: "James E.J. Bottomley" , "Matthew R. Ochs" Cc: Brian King , Michael Neuling , "Manoj N. Kumar" , linux-scsi@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [patch] cxlflash: off by one bug in cxlflash_show_port_status() Message-ID: <20150814203525.GA27158@mwanda> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) X-Source-IP: aserv0022.oracle.com [141.146.126.234] 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.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY, URIBL_SBL autolearn=unavailable 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 The > should be >= or we read one element past the end of the array. Fixes: c21e0bbfc485 ('cxlflash: Base support for IBM CXL Flash Adapter') Signed-off-by: Dan Carpenter Fixes: c21e0bbfc485 ('cxlflash: Base support for IBM CXL Flash Adapter') Acked-by: Matthew R. Ochs --- To unsubscribe from this list: send the line "unsubscribe linux-scsi" 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/scsi/cxlflash/main.c b/drivers/scsi/cxlflash/main.c index 0720d2f..fd70101 100644 --- a/drivers/scsi/cxlflash/main.c +++ b/drivers/scsi/cxlflash/main.c @@ -539,7 +539,7 @@ static ssize_t cxlflash_show_port_status(struct device *dev, u64 *fc_regs; rc = kstrtouint((attr->attr.name + 4), 10, &port); - if (rc || (port > NUM_FC_PORTS)) + if (rc || (port >= NUM_FC_PORTS)) return 0; fc_regs = &afu->afu_map->global.fc_regs[port][0];