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=1796389170; b=vYXydjT1Okw1+9Ns175pSKRcVRTu3dKofCSgPnNgfAmIc9brrumSHu6FY2+In6JrfBYD p/54ofTR+AUJci4fbOo/eY/pc1JAvdw+8RSmK7qU7TzQhK/XyPjcrLM9YZahZckPDKQUF Au35PWXBWRHc18AWSgbbaOzJ0eaWbFtTwyvd86h6Z9uFIZ38+pXKjtCT0OJXmL/7KnDys Xmcly9+Om8U9O46hOyqUVECQfqb5e9dsaK2kDyyEdb/Pcl0z4DdtSOP5t3/ZET8fXp0Ia KkF5S/QYoVY/D6eXaNGZS5uMCIvRjD4UD0TUidwussdQX5uk1BCJLyAl0o9TrjaD9Mw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796389170; 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=2WS+kfDFsu10aDIUwqLDQM/2HtJpfTkOTD6QurMKJyo=; b=Sds4dgxe5bKXr1jIRzzlHnx8dMTyaJ6om4MhLCxetlxgVQSkrR/sa248o27+H5HqJpFm DsQI82qetPGhD/6aAgn4soGCz5QDz8H66r8h82rM05oLGs/yFhCAm6bRnTv54Y/V+vsCo FwVvzKJa+JygQsD8QubYj3xiVt25ujHlxIyV4/ZPl3DZHjPKS5C5nyrpLbYyV9J+kGw8i d4PK/b+lcLTSNQc6EvL/RSVDKGf6ClKZ0wIzM6s8gzY0bzyUn9jDiO0dZLcwkwmaEVSuf Y8w4K3JrUxyYCHPmo3sD5F/FOHGSwBY6RR8oIqI9f6rs/qY/Dz/oCXJ24qRMiS8oNDQ== 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=YQz8pa34; 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 531D4606A32C; Fri, 4 Dec 2026 12:59:30 +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=YQz8pa34 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 718F51F000C2; Fri, 4 Dec 2026 12:59:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796389169; bh=2WS+kfDFsu10aDIUwqLDQM/2HtJpfTkOTD6QurMKJyo=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=YQz8pa34e52JkbNg0rXtrvSbwongm7v3uEmp+5E/+CZYgAwetYvs0gUbmwqZcFCak yvXAfNcFOhfPoa5q7wqbgUWOwtddyKqs2vI4nJNdFazptGI8Xvc1kwM/Dd8Q1iGS6n MggksVhhOjOWUzZofuWYoQtahmfAe7H5oH63aF1U= 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.1 0849/1059] tools: gpio-hammer: Accept the maximum number of line offsets Date: Fri, 4 Dec 2026 19:06:20 +0900 Message-ID: <20261204100706.021879481@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100643.980430235@linuxfoundation.org> References: <20261204100643.980430235@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 6.1-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 54fdf59dd320d..62d346b67d46e 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