From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CF4F9C43381 for ; Fri, 22 Mar 2019 13:00:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 950322075E for ; Fri, 22 Mar 2019 13:00:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553259602; bh=zxjaSCvdHWYbMC3EMDCInJ6tzIGqztMxGN1jJyuSQac=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=I82kozTB8y2fCvy1hg45uQYdJaMSfL8rin9WTWudmy6JWq+2uj8oHQNSe4w+okTY3 rEOoEX+g6zr7182Hv2LQMUMCp/AcpSMmXUrpiCJBNtn7SgAAawMa5ad9/AZDX09ju4 72jT96sd8ss3PDIqxJnZxVqjswXYL2c9xZPgXJ3U= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731860AbfCVLor (ORCPT ); Fri, 22 Mar 2019 07:44:47 -0400 Received: from mail.kernel.org ([198.145.29.99]:47806 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731881AbfCVLor (ORCPT ); Fri, 22 Mar 2019 07:44:47 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 9E2922075E; Fri, 22 Mar 2019 11:44:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553255086; bh=zxjaSCvdHWYbMC3EMDCInJ6tzIGqztMxGN1jJyuSQac=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ll3gqN4L0bGz32RDDE4xAUNc8wiX/lfMEJGz7ljp7R0QSW4V0zFJPi7k4SM4wpaKJ Y2xWmYdjb6FvwwwhvxHAdEb9ewE/HFOv1Eq3Uhk4zouiO1TzLVvMMiKH73lz0ciPfY 59aoYYN3Jp93qjMrjhjWJhqCqYD7/LRbYYBmT8SI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alan Cox , QiaoChong , Sudip Mukherjee Subject: [PATCH 4.9 083/118] parport_pc: fix find_superio io compare code, should use equal test. Date: Fri, 22 Mar 2019 12:15:55 +0100 Message-Id: <20190322111222.509290006@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190322111215.873964544@linuxfoundation.org> References: <20190322111215.873964544@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: QiaoChong commit 21698fd57984cd28207d841dbdaa026d6061bceb upstream. In the original code before 181bf1e815a2 the loop was continuing until it finds the first matching superios[i].io and p->base. But after 181bf1e815a2 the logic changed and the loop now returns the pointer to the first mismatched array element which is then used in get_superio_dma() and get_superio_irq() and thus returning the wrong value. Fix the condition so that it now returns the correct pointer. Fixes: 181bf1e815a2 ("parport_pc: clean up the modified while loops using for") Cc: Alan Cox Cc: stable@vger.kernel.org Signed-off-by: QiaoChong [rewrite the commit message] Signed-off-by: Sudip Mukherjee Signed-off-by: Greg Kroah-Hartman --- drivers/parport/parport_pc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/parport/parport_pc.c +++ b/drivers/parport/parport_pc.c @@ -1377,7 +1377,7 @@ static struct superio_struct *find_super { int i; for (i = 0; i < NR_SUPERIOS; i++) - if (superios[i].io != p->base) + if (superios[i].io == p->base) return &superios[i]; return NULL; }