From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796383478; b=jL9U0hfOaDmIO7dCgprsUUGNNL1sVLNmdFbd7xgKF5UWvC/M49ZHfwaqjHHLq/lkiS0q NzqKdciCXpK1g2qXG6hotLZ3yPjyGZzDLGafE1+xlITVboURQ8jNPzQ3MSxV24Y6JfUuM boyhl/6P3gBzCydIyTjhNIE4vB7zaj482OuxI1hlYe9UCh6fUd1DOV+e/OKE0dPmR4Fr9 6HvXhs3AeT7+9sJSIpKyAM1syrrAeL5gQpqpIKC3oqwZraxr5Z3qTOuwF12pPVekFmRYT 8+a1O1XzpYYfZ7PFhYOe3OxIY3j3Ybl7UOUI1Ua8KU5sfY+uELc4wdThpGGA3CWW6Pw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796383478; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=Mpj/9phjK6kWwmVmMtx2tGEmNCdtU+Sy5TdDtMNQfxA=; b=yfiuuWcD301xTFmPBAu/gDxyCTayCz4kUQivbgnFbIDm6ELLoS+rYlvmDhZK4dXnHMzV KZh2fCfJUofNLgK0UdWrpa/fX8v05OYwH9LhjiM/9aVcnxlOIlsWoU9hWE8vCRPJJ9ud6 yTuEbFefCoXGBSfgpvRzfcta2vcGmWaPmbBjr6SWg+H5GM6UJY5C+hcMp8Im8HdgI9aQ+ Glxjuhz8pmn4vAjNQAtpAh81mdZl9k72mPS4tUOrAlvqP9Q5Ew7Nzury69asOVKnFxDl+ q+L16TPlUlCORDwsMlJUmCte3weMQJdyxrvAOLLfYz/0fwnNAV7tjMiGEMMfxN6OPrQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=oSscHHwD; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E0666606A691; Fri, 4 Dec 2026 11:24:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=oSscHHwD Received: by smtp.kernel.org (Postfix) with ESMTPSA id 02D5F1F00935; Fri, 4 Dec 2026 11:24:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796383477; bh=Mpj/9phjK6kWwmVmMtx2tGEmNCdtU+Sy5TdDtMNQfxA=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=oSscHHwD4pbqnjFPxS1Lhb1PT5uapZZv1yeXb9tRbRn77cmXrCiiUSKjhDpQYKT59 q0uddaMVBN7K/uNDelzMpmiBsE0OFkR8NccvKDwnyrXkk1HT/AKNTjCUBf6lBdILRd 2P5E2yRg3e4nA6lKen1KJMaQyrUky7soVbej1VS4= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Zhu Jun , Bartosz Golaszewski , Sasha Levin Subject: [PATCH 6.12 241/555] tools: gpio-hammer: Accept the maximum number of line offsets Date: Fri, 4 Dec 2026 19:04:44 +0900 Message-ID: <20261204100618.375641119@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100603.988357525@linuxfoundation.org> References: <20261204100603.988357525@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Zhu Jun [ Upstream commit 0b3f1876d6db7fad0391ce714b315269b0dd5758 ] The offset count is incremented for every -o option, but the final check rejects the maximum itself and reports one extra offset. Only reject counts above the maximum and report the actual count. Fixes: d1ee7e1f5c91 ("tools: gpio-hammer: Avoid potential overflow in main") Signed-off-by: Zhu Jun Link: https://patch.msgid.link/20261120061827.98066-1-zhujun2@cmss.chinamobile.com Signed-off-by: Bartosz Golaszewski Signed-off-by: Sasha Levin --- tools/gpio/gpio-hammer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/gpio/gpio-hammer.c b/tools/gpio/gpio-hammer.c index ba0866eb35814..1b33691a68a36 100644 --- a/tools/gpio/gpio-hammer.c +++ b/tools/gpio/gpio-hammer.c @@ -159,10 +159,10 @@ int main(int argc, char **argv) } } - if (i >= GPIOHANDLES_MAX) { + if (i > GPIOHANDLES_MAX) { fprintf(stderr, "Only %d occurrences of '-o' are allowed, %d were found\n", - GPIOHANDLES_MAX, i + 1); + GPIOHANDLES_MAX, i); return -1; } -- 2.53.0