Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1980195imm; Sun, 23 Sep 2018 16:53:07 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZpey/qRPrfA1tjBIePB6gHdt7XdAL3yh8/fIR7K7+gL7TAC3r0UDnP9CqA0Fnhm9kB5yem X-Received: by 2002:a62:5d89:: with SMTP id n9-v6mr8006813pfj.102.1537746787473; Sun, 23 Sep 2018 16:53:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537746787; cv=none; d=google.com; s=arc-20160816; b=EGz6ybTDfH6vXnjWZluXrp2rdbJaVUq13UkhWe9ziNu9jJHXVCU3Q8Bd8vgvcV7zBu twYHdIPIrxXV474es18mitOVqYnksEbS3R+6avrI1Su3my4xiZhNhMMEym2H/FgvKpOB udD4mlLMnMxJxcBgTEk4A8wHyhsXM7uV1mEOLYsZY73k1d9B/p7ULsiK5vB8MVGL3xMG L+ayCrMvmvL0rSwgEwAMY8CcR5jurAmtNWXWFoe4q/Put8hV4Lfs8DyMk0twuH7YF6C+ un43f0K+kPy4aFrqQPNWbGswbMrKhChA06hTcolDQAljZJV8JD1MOfmU5bkwBGTCO0Li XnJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=Mg0atZwESfwIvpH4FO9elFcUPvpgUp8Akcfpx+l/4o8=; b=UhhS+ObVyzAoa+pHBhyrIFWIpmjlzoP6K8p8rVrZ50Bcc62zs/yPOuLONEohbYlgy8 Ffl/JCkeSw3bOyf6dU1rWkuR6z7Y5R8aclM94kRwGbzsVKUQ2XY6rk6IFJ2h/GWmpjl4 R1bvNHk3mVqX/1bQHknbK5vOnz7Dp4lqQ7c4XNlgKhgo63ExdMlhTwr6DYdc4yQy8cHJ zSVpdfUKQnKKhh3/MNDcS6TeqYfLRses78uv6kOWXF9NEVhInriW5UVnWWKFZg/KteqC QOpRck2PVKDFJUQd0fDf+xh4P0tgq5EYqRKuOb9bZ+QHKEDpVLZYlN7gQDZxQMGUOZkM 1xGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=NlWr2aPv; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z22-v6si6969709pgl.261.2018.09.23.16.52.52; Sun, 23 Sep 2018 16:53:07 -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=@gmail.com header.s=20161025 header.b=NlWr2aPv; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727333AbeIXFwG (ORCPT + 99 others); Mon, 24 Sep 2018 01:52:06 -0400 Received: from mail-lf1-f65.google.com ([209.85.167.65]:37959 "EHLO mail-lf1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725932AbeIXFwF (ORCPT ); Mon, 24 Sep 2018 01:52:05 -0400 Received: by mail-lf1-f65.google.com with SMTP id z186-v6so15160781lfa.5; Sun, 23 Sep 2018 16:52:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Mg0atZwESfwIvpH4FO9elFcUPvpgUp8Akcfpx+l/4o8=; b=NlWr2aPvPsEDztjPTg3Dpib4GS4ZiJaa/tBuMFavHB9ZhRnC8KcMfFPIr/yI6xcRXb yywZ8JJle1hJzKCPf1ScmVflVsBGe5x4ElqJ7Gqo193QiGa2fbAsK2vW0y3uPd9vqwvq bgBXvcy/ydBbGFBwGQIZLgCDNrPWsiRukjwFUr/euIp1iO+EbveIU2Qjyk1uRK3/OZjn uqJum//WQjxJvRTFuKjZAbd8CUfhtXtTwsHGEkqMvpSIjxOJWeeqHyu8GOTlXODaUBY3 r2tl7cWotTOw34iEzZAcyXTPwsJsvKKqm88l98KPFbSebGtM/Y5Kig/87NSoYr/FWyG1 CnJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Mg0atZwESfwIvpH4FO9elFcUPvpgUp8Akcfpx+l/4o8=; b=GFQAWR86eWHEp0Fs0wxHmOKArP20v/wrZAjQHw42Tjk9XqgUF6AVEN35szWOtq1lpu Pxl+SXhIVkLq/gmlVAoGuDxMUYIdwUASBYcwzanrt1VnnHTOSFhu8cLuuHRc9o9uqRD3 YcHehaZZaDdTokXytCMpM+kH6WBodpRGE+YCSUy9AHrHQZy5FvYlfEyzyum66UwjRxs3 tZB7wUX2/TnWNeIqQYilN7zryKY7eEMulMLtR2ZrPsJZiiLU2pRrXUVVUTXJH/cwA0xK 4mlIZhxswkjNy87IEdfog/S2V8KJQxV4hYu1PVGBQrNjuG8yTss/+F9uN4ZebD7p1f5B Q+mg== X-Gm-Message-State: APzg51BxQM9Qd8+73NU/iiMUcyI7PWgEr5i7aUGW731Dur46Fqlknrmd UCnt7ho8bjp/afxyNVIGVPs= X-Received: by 2002:a19:1952:: with SMTP id 79-v6mr2474242lfz.85.1537746753683; Sun, 23 Sep 2018 16:52:33 -0700 (PDT) Received: from z50.lan (93-181-165-181.internetia.net.pl. [93.181.165.181]) by smtp.gmail.com with ESMTPSA id m8-v6sm3419718lfh.25.2018.09.23.16.52.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 23 Sep 2018 16:52:33 -0700 (PDT) From: Janusz Krzysztofik To: Linus Walleij Cc: Jonathan Corbet , Miguel Ojeda Sandonis , Peter Korsgaard , Peter Rosin , Ulf Hansson , Andrew Lunn , Florian Fainelli , "David S. Miller" , Dominik Brodowski , Greg Kroah-Hartman , Kishon Vijay Abraham I , Lars-Peter Clausen , Michael Hennerich , Jonathan Cameron , Hartmut Knaack , Peter Meerwald-Stadler , Jiri Slaby , Willy Tarreau , Geert Uytterhoeven , Sebastien Bourdelin , Lukas Wunner , Rojhalat Ibrahim , Russell King , Tony Lindgren , Yegor Yefremov , =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , Janusz Krzysztofik , linux-doc@vger.kernel.org, linux-i2c@vger.kernel.org, linux-mmc@vger.kernel.org, netdev@vger.kernel.org, linux-iio@vger.kernel.org, devel@driverdev.osuosl.org, linux-serial@vger.kernel.org, linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Marek Szyprowski , Krzysztof Kozlowski , Linux Samsung SOC Subject: [PATCH 1/2] gpiolib: Fix missing updates of bitmap index Date: Mon, 24 Sep 2018 01:53:35 +0200 Message-Id: <20180923235336.22148-2-jmkrzyszt@gmail.com> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20180923235336.22148-1-jmkrzyszt@gmail.com> References: <2785169.v6aIfS3K2k@z50> <20180923235336.22148-1-jmkrzyszt@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In new code introduced by commit b17566a6b08b ("gpiolib: Implement fast processing path in get/set array"), bitmap index is not updated with next found zero bit position as it should while skipping over pins already processed via fast bitmap path, possibly resulting in an infinite loop. Fix it. Signed-off-by: Janusz Krzysztofik --- drivers/gpio/gpiolib.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index a53d17745d21..7d9536a79a66 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -2880,8 +2880,8 @@ int gpiod_get_array_value_complex(bool raw, bool can_sleep, __set_bit(hwgpio, mask); if (array_info) - find_next_zero_bit(array_info->get_mask, - array_size, i); + i = find_next_zero_bit(array_info->get_mask, + array_size, i); else i++; } while ((i < array_size) && @@ -2905,7 +2905,8 @@ int gpiod_get_array_value_complex(bool raw, bool can_sleep, trace_gpio_value(desc_to_gpio(desc), 1, value); if (array_info) - find_next_zero_bit(array_info->get_mask, i, j); + j = find_next_zero_bit(array_info->get_mask, i, + j); else j++; } @@ -3192,8 +3193,8 @@ int gpiod_set_array_value_complex(bool raw, bool can_sleep, } if (array_info) - find_next_zero_bit(array_info->set_mask, - array_size, i); + i = find_next_zero_bit(array_info->set_mask, + array_size, i); else i++; } while ((i < array_size) && -- 2.16.4