Received: by 2002:ab2:1149:0:b0:1f3:1f8c:d0c6 with SMTP id z9csp1956478lqz; Tue, 2 Apr 2024 02:58:21 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXd5hiPt4GBgrXz7FAJKJNL1zdjRr7Yfj8kz5G95FWSVEB+RiQ6Rp3aML+6kXal2gBlHknf0X0iimmJ3Hits+46qxaUkHIZl4H16p6qzg== X-Google-Smtp-Source: AGHT+IE82muNeoneJtCxovzgx7tZq67vUccv6uzEFGstVArT1IAoCzHNakdFqx8umPfBoOQ0iF3c X-Received: by 2002:a05:6512:acc:b0:515:9ae1:9a6e with SMTP id n12-20020a0565120acc00b005159ae19a6emr8625317lfu.67.1712051900922; Tue, 02 Apr 2024 02:58:20 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712051900; cv=pass; d=google.com; s=arc-20160816; b=wrV69E+THjGEgF1ElK95C7CGrovo1XCK6syL9T35W2y7uIXbkluX7/GEe/2dcSOOde 3ws9Kia1+URW16aSwtv2/DlyCEaoJFuhnVWAuSRuXy6R7W1ix8qAEHKKf0vAzf8MVCO7 bZSGvTARco0vB71Vsk2/EqEEbn238oTccRyTNOqDWdnAI/Q/i3iH3o+LLhUOZIDZvhst 9mxDz2rG1AjohmR5jk7QlSX1yh2P73PV1O8RyRpHxEVklnwTraZNQGYSmV9oAt5g+Pdr 8b33TcIm2fcn/5lajw2HYONvFAR1+y7UitME/lDMTJex9LIlXNXc4P7neYhLbC+I2DEt 15EA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-disposition:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:message-id:subject:cc:to:from:date :dkim-signature; bh=VwgQXgoUW3ptEVLp+FHIBGiwI73MMNowi6SZaD84hB0=; fh=BvG4ejLPODrzADcUAxTMwOadsX+UCpIdjbWyZNyNpcU=; b=S7l+MvoYUeTsD8+abDj+TJVd7s2COfd4o4FCpZvu9uwO9KYzCe0bjgT+koTKtlapRu 9bgN7Kut4AhNWsCeib6vnP3jQhkAT+nTxX3vaEqxQ9kD7IW3Wb38qh10ySbddQJahyYf kc73KKk9aNvJ7/EC5vnzSdVTtSVpBrjPsl3ztu7Uy54EWlnYLRtggZubhVQQOkZJk+Yf pfLg5X6/QirPESgmb2dvDKx+REcvMxcrv/Syg/p74QgXYavl2EsobHJGR3fqtFbZ41G7 PlhfKemZQcv2nwJ6f4XJdJYs9ebM7373bUd5urvTzaC7a4MchdVb6sQUr0169m3V4wJ5 KRng==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SkHkeqkj; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-127675-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-127675-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id kl4-20020a170907994400b00a4e4748b25csi3493547ejc.555.2024.04.02.02.58.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Apr 2024 02:58:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-127675-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SkHkeqkj; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-127675-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-127675-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 94B6E1F2450F for ; Tue, 2 Apr 2024 09:57:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DB4EF5B693; Tue, 2 Apr 2024 09:57:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="SkHkeqkj" Received: from mail-ed1-f43.google.com (mail-ed1-f43.google.com [209.85.208.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 647DD5B699 for ; Tue, 2 Apr 2024 09:57:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.43 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712051822; cv=none; b=F+lpkgpg6+6XFBKgeSF0cKOTZkXMgwNi7Ph3FUbuFJ6oO+dUtvQE0rYDrh0KYh1D/Qz2jBgmsSclyW8vtYwcDJjkGy7BqBn+jz3rMG2Li5wNiXamDJcxEQ7lMi6gIxMHP6wbnRjxF9wickbZErvHPvQowfizG9wvVLrcz5cxxN8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712051822; c=relaxed/simple; bh=iP61wYLmnnQVWQX/vBTSXN9AMov1jT600DiQQbSBwlI=; h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition; b=aTOqZJKTlB6QwjepQtNKyyE78AUzXKBHIfCPfSj8ueQNoBEJTaMLD6Ii0L+a/zKCVHAbwrWsAZxFrNtyY665qaHXcra1qLF/aSfs+ws8ZFjxeGHM+XGaYYILCobAp3u6BRaVWdQ27N9KJatYnHs4jbxKfaxze1DVgOKAaS3PWbY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=SkHkeqkj; arc=none smtp.client-ip=209.85.208.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-ed1-f43.google.com with SMTP id 4fb4d7f45d1cf-56c5d05128dso3463830a12.0 for ; Tue, 02 Apr 2024 02:56:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712051818; x=1712656618; darn=vger.kernel.org; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :from:to:cc:subject:date:message-id:reply-to; bh=VwgQXgoUW3ptEVLp+FHIBGiwI73MMNowi6SZaD84hB0=; b=SkHkeqkj6Y9XZxGuEhACJ7noJvDVA49Zup3UxNSleXZBmN2cLL1xp/0RjmvJyvkC6d vxcmuwrR1GJHRqjlxnbPhbzV4jAESXRE3m/Qbkl0ezYZGQkCi49XYs1ctwry2ukUQLnB nuYXjbd+L+TxHM3bkry+m4jAanAwPpmedZNvUYN9QTGnENqGk/slYD3s/PSuNTf4iAGq 76Hgr5bOcmNAi3984+WL1snjjEh/PFbMTA/XOKeO8QF+3dA7yywkCHD/UkHL2npaijGt mAQed/iDZmfWw3MXsyUPSx6OUKYuU3QHsS2Ls2Xox0lP0fpXEm2dCd6B4SB9Kd0kGeIB xVvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712051818; x=1712656618; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=VwgQXgoUW3ptEVLp+FHIBGiwI73MMNowi6SZaD84hB0=; b=onz3zNSKYQ+4cFXu8v9QtX4L1jg/MGEpTcQWLsDcYJy5ohnQ8RSSiNJQrM5JkS8Ibr +pp6UC3Xx7N3pY8hTXaukJgcVJSYx0ILldB2+3SVE8gV2jqkJ5BrsoGU+AZXaHSjsYt+ wlOrFdpMTNCGoKB7WHN88zHw5yWduNsFP8hCgWuRzRr462pcdwy+6myL/9MXWmSW5VpA qVI74VnWp1sPXivqmkG2H6qM29keM7t1Zc+zCd9BNLMzw0OXNxhfakorjXZAHivkoEz/ 4fIjhHeqRGfkYqZcfPhS0mclOaUk22T3odn1ejBceIoi3e+HfZADJ5ob9KlbqLFjOX90 SDUw== X-Forwarded-Encrypted: i=1; AJvYcCVMN/4MjaxmvxJbEwv8zltDpOfmtTUe2dNMlNMkWg5bvXGIPKl0zwHwDFY/nfjWwlWpwz3Z/kA2fEdJFcQAQgxYOWGKTRPTmIVpeXvX X-Gm-Message-State: AOJu0Yysx6iT7H5k/o7hKGns5L1T8UDAhj/YFS4u/DQyjEtEEmHL0pUt krAKclvzESajgSyw7xDRSuiwCSzkx8qnu15wF9heEl8dmSMFAzETj2Hk3bJgGE8= X-Received: by 2002:a05:6402:27ce:b0:56d:b687:5a57 with SMTP id c14-20020a05640227ce00b0056db6875a57mr8537324ede.20.1712051818415; Tue, 02 Apr 2024 02:56:58 -0700 (PDT) Received: from localhost ([102.222.70.76]) by smtp.gmail.com with ESMTPSA id eg14-20020a056402288e00b0056df6ed8f4csm119336edb.37.2024.04.02.02.56.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Apr 2024 02:56:58 -0700 (PDT) Date: Tue, 2 Apr 2024 12:56:54 +0300 From: Dan Carpenter To: Quinn Tran Cc: Nilesh Javali , GR-QLogic-Storage-Upstream@marvell.com, "James E.J. Bottomley" , "Martin K. Petersen" , Himanshu Madhani , Larry Wisneski , Duane Grigsby , linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH] scsi: qla2xxx: Fix off by one in qla_edif_app_getstats() Message-ID: <5c125b2f-92dd-412b-9b6f-fc3a3207bd60@moroto.mountain> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Mailer: git-send-email haha only kidding The app_reply->elem[] array is allocated earlier in this function and it has app_req.num_ports elements. Thus this > comparison needs to be >= to prevent memory corruption. Fixes: 7878f22a2e03 ("scsi: qla2xxx: edif: Add getfcinfo and statistic bsgs") Signed-off-by: Dan Carpenter --- drivers/scsi/qla2xxx/qla_edif.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/qla2xxx/qla_edif.c b/drivers/scsi/qla2xxx/qla_edif.c index 26e6b3e3af43..dcde55c8ee5d 100644 --- a/drivers/scsi/qla2xxx/qla_edif.c +++ b/drivers/scsi/qla2xxx/qla_edif.c @@ -1100,7 +1100,7 @@ qla_edif_app_getstats(scsi_qla_host_t *vha, struct bsg_job *bsg_job) list_for_each_entry_safe(fcport, tf, &vha->vp_fcports, list) { if (fcport->edif.enable) { - if (pcnt > app_req.num_ports) + if (pcnt >= app_req.num_ports) break; app_reply->elem[pcnt].rekey_count = -- 2.43.0