Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp2021043imm; Thu, 24 May 2018 04:39:09 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqwnFKQyuuOy+2WIcYtFjiFqpxbVnh7z3SQrQZMQYA/MHmTq6PMyedPkg4ZUW3XIuVseWk6 X-Received: by 2002:a63:9e42:: with SMTP id r2-v6mr5577651pgo.436.1527161949878; Thu, 24 May 2018 04:39:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527161949; cv=none; d=google.com; s=arc-20160816; b=oPVt2EiTFscCEOhOQr4eoD6obXe1gzwHfjonuTdWIl6qAcnoZa7Sku3UZluK8OZDnZ hoiNx65kBC2wY41b9lDNJu5fPGRVSFRrrHTOX618wrliG5whGr64q3ps7hxxUZ0fAQuN FALOuAuLCf27PHeYH7LoGUpiWc0oNyjjCDaH6mhcN5S5dPtC8EshZ3RkF+vJe2V+a0Xm gtDwqHz5apaRNkWUjAwUWSjmPKY4QtEbVCme/Rkl2WmPs2PsTrMER5mMo5wAq+dbNABq vEXXsF406yi4xt8zCP7uE/e76v28I4ltVQGP+SK6Q0vaRmTpOrFtfgjbEhh/WfFX+bJl R69g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=N2z6xizFl7G+xxwW9THVISaud650EkZ7YALlLZnm9JE=; b=q9Oa7SVJL8MKtyYOgOEErjIDfv3TWzuG571fxHvhN7kAvZmf07oaXlPztQ3+TS2NU5 dXKCtK2jHMrwXTIHZtWSzURaJmLd0RoI6/F7ppu/jWnDA+x7X5SmK+5UezRHSRnvxQnK oMDpaHytupKrrWgXjHek+0GaTtQQDZGpHuvL7RyC8ZNZqF+0vFBOLBFHsCF9bkcQxVmI 2kDp5MBy8xRQDQv0jaaJNiTCan2ZXV7Bs9HgWUOW0asYKQmwM8gi9grS36dtkR+lzl/A BcBK9YXfAaeb3ZZaGywXV7R3WD3eFZnEewX4iKQNvEt0Vv8vLWB5AjTE8XiahwwUSuLm X51A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=hGuDug23; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a81-v6si21533770pfg.200.2018.05.24.04.38.55; Thu, 24 May 2018 04:39:09 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=hGuDug23; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S967372AbeEXJtV (ORCPT + 99 others); Thu, 24 May 2018 05:49:21 -0400 Received: from mail.kernel.org ([198.145.29.99]:37222 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S967345AbeEXJtO (ORCPT ); Thu, 24 May 2018 05:49:14 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3764220847; Thu, 24 May 2018 09:49:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527155353; bh=Mm4R0O/6jVfdg76I6vGYdznrRLp+fRYSYJG6Lt7WJCQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hGuDug23aijee5LmuTutom22UV3icMz3BFe5FflkOH6jxC3kL2LM2d04diY2Bfxgq Ikul4WbR7yWRw4tsJ41CW19A+CI8TttR8BMxyr6dxTYLkyesOlEiGgolOj6c0MzNup 8XUGWD0U4BfxAoSNxSyiuawO1iW2rRI/Lx0suPZE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Johannes Thumshirn , Matthew Wilcox , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 4.9 54/96] scsi: sym53c8xx_2: iterator underflow in sym_getsync() Date: Thu, 24 May 2018 11:38:37 +0200 Message-Id: <20180524093608.611763912@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180524093605.602125311@linuxfoundation.org> References: <20180524093605.602125311@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Dan Carpenter [ Upstream commit e6f791d95313c85f3dd4a26141e28e50ae9aa0ae ] We wanted to exit the loop with "div" set to zero, but instead, if we don't hit the break then "div" is -1 when we finish the loop. It leads to an array underflow a few lines later. Signed-off-by: Dan Carpenter Reviewed-by: Johannes Thumshirn Acked-by: Matthew Wilcox Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/scsi/sym53c8xx_2/sym_hipd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/scsi/sym53c8xx_2/sym_hipd.c +++ b/drivers/scsi/sym53c8xx_2/sym_hipd.c @@ -536,7 +536,7 @@ sym_getsync(struct sym_hcb *np, u_char d * Look for the greatest clock divisor that allows an * input speed faster than the period. */ - while (div-- > 0) + while (--div > 0) if (kpc >= (div_10M[div] << 2)) break; /*