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=1796380259; b=p8kNuA3BTsrM6dJNLOPsPAb9T0Ll1Xwq4u06W57MbEDzBjdqBcVvzEXsDPxsu5o/t64Z X6/lQIYfaHHQpZ67XV0kJSyzM9yq0Ru34aEVB8XZzNtw6jKYFS7pq5S2T2rKtRWjYmMWt YbTcnp6Y+V8mPl3X0zXothdacns5buFIJCteoQVjcWueRkiIVDKTN7MGp556bAgwBkZQq gXlKq/hnqZXtdwDqJ9EYyzPPWScFkoJtYSHjuGc1J79ciqz8ifJ/gg0bS8QePdle0atVI kBYr++Nhv5a6ntMc2uLrgTesn15sofuxuZaPyvmAQ2wUXFgRG4CSThoGV3jPs7uQLtQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796380259; 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=Zcif+oRsVsIufHUfGV8t/46ga2MCrVm9d1QqTPBtyrs=; b=b2vO1drE0/nhpomCdwQ1v2Sjg/tgnVeRmI05e2GnqbXUJlKdDGOI2t4o6r7+HWWaWqu8 YoTe76GZYWbq9r0IlfSyoREy+EXo4j/pUcpzRDblSZVbzMQuASCZ9n+Ckz3IM3ytbJPCM rZEp92vGegw+ZgLJxh7lR4e7HOUmF5ToU9diArTNEWTQxnUGHhHMN2wgtkVAenjFsazKo Sck+aD3qG58PBkcdTgQ/Iyh/22Nk67G5ychN4XdspSYth1jOl8eMB8NOzdRuv4Zlhgojp jftY+EQq8TWFm4yA3SJQGLkcdcguJovyCZZnQHpK4A1ft9sxtZK7Fp0i2Ui/0gNO1nQ== 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=Kvtlfu+7; 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 A4268606A32D; Fri, 4 Dec 2026 10:30:59 +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=Kvtlfu+7 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1E6A61F000C2; Fri, 4 Dec 2026 10:30:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796380259; bh=Zcif+oRsVsIufHUfGV8t/46ga2MCrVm9d1QqTPBtyrs=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Kvtlfu+7gP4CC2Qg/8Ch/DLKYZ5u54cNcs3nba0gjjCn8qE0muzRPvYV5D4UEU4Bb v2ciJWs0VomZsnU6Yea7HYez73zccay9ArnGV/CBRmk1tvCuJxnMH/DJ1a7FBEj+r5 iDo7kbnEKKCK45lpyrXt8TO9gOBzNecubsUPOEXM= 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 7.3 196/742] tools: gpio-hammer: Accept the maximum number of line offsets Date: Fri, 4 Dec 2026 19:01:00 +0900 Message-ID: <20261204100640.298916226@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100635.034361255@linuxfoundation.org> References: <20261204100635.034361255@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 7.3-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