Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp1980229imm; Thu, 24 May 2018 03:59:29 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpzO8qKLb607RukHw4RB3dHMPvWy0bGxlpPBRERMPTMZmEUImUhZQBfycqMpHTmmeraZC5f X-Received: by 2002:a17:902:57d0:: with SMTP id g16-v6mr6429745plj.222.1527159569445; Thu, 24 May 2018 03:59:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527159569; cv=none; d=google.com; s=arc-20160816; b=dtItZAqnrtmwBcdC/D/45QXCJ7jFUTRHN7x3++UcAzdgKzoGWItsbJpXK1uKGVuPwm 7vS1eHSWfPnN6B2X9Ufum7bAqq97uwmxJ/1zBr05Cw0B+VovbmsebEr3PggOFui+gIco gozn3+0whlSy0yLW8nM+7jblkNxFOlG1k5MAf42O3Dl39kZZIi10yWs/EsUdEGfY8UBX 6n2B6YREde5lTLqISu3ffwzO70nrOoDiTl4NiWnMSnAtwFWFlruBqi1AxrQtALUYq6nf f0g1vnnq0gBJEMwesqjhfJztikvNBI4lTXSuA9dqw2/QQakUnNCohq0LfVz/I7VwjBlX 5icg== 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=Hou3ddALr4QQVeYo3CyBvaeySWC2ZfgSu5wcy+1d++4=; b=abQFofBKnNY5JcFeo8J/8yJyfoOtMOvJ4npmtax6l7P18/UbgVLEOIfM2PsldKAff9 YrA65vkyjRyagkK/0c8CKtDafwOM2yy024jpA4oki2eUm1dtL/ZzkwXq5vTF2VUp6oYX jKgVZgLJRaoA0DkrfMSujfM47fUC+R2Qi4jAJHk164TVhRBoqHyFe/JetYPPG3mJ06d5 QDn5WBOwHKEG3XsOtqkjJXURSYigUlDzwmFD/JTWUQuRV6J4wk7wG3uCIO+5fGiqzdeI CDWoFq1IrMs2mvpsnZsBfj+360EKgjf/RxC6cehwJhdvkrASNwCvQq16EBkWut9QX4qx 0fzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=d95VygIX; 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 a6-v6si979833pgd.579.2018.05.24.03.59.14; Thu, 24 May 2018 03:59:29 -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=d95VygIX; 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 S968422AbeEXJz6 (ORCPT + 99 others); Thu, 24 May 2018 05:55:58 -0400 Received: from mail.kernel.org ([198.145.29.99]:35880 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030206AbeEXJzv (ORCPT ); Thu, 24 May 2018 05:55:51 -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 372EE208A0; Thu, 24 May 2018 09:55:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527155750; bh=AZweDxwFZIgfxWwPV12GQQu2B0LkAk4G4XUllPSIBUg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=d95VygIXj6Op78tDVbwt+xtvMKfeQdkP7WDENG0QUX5NhJQUo8XUbZNgA4nj/We1S zenud6AXdwcJIOQTRVHRLZ8yt1RknTpTLkeje0kO/SONMgLFR/nZxHY2VlL/HfHnPg 3X2ThxLe03LvRz7XkEl2pXMTwIXm9sbOERFh8Ql8= 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.14 103/165] scsi: sym53c8xx_2: iterator underflow in sym_getsync() Date: Thu, 24 May 2018 11:38:29 +0200 Message-Id: <20180524093626.183969575@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180524093621.979359379@linuxfoundation.org> References: <20180524093621.979359379@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.14-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; /*