Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2577338lqp; Mon, 25 Mar 2024 03:17:16 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXHiKuz/Vu3IpKOaYdihSQHOVe7gBVZXXaaMtpCcQm6/w7WmElKSrtz91hV5FmLWnoaCShkprl4A3WqUNqpGjppB/MRzQxA18l4dsdw7Q== X-Google-Smtp-Source: AGHT+IEqTu9AU/Bj0skRhd0bfUUQqLVPERou+tEQ7mV2Qxi2+nvB4zpVOeRIGXHCOQXflQj+U10j X-Received: by 2002:a05:6a00:a27:b0:6e6:9942:fd97 with SMTP id p39-20020a056a000a2700b006e69942fd97mr8587522pfh.15.1711361836258; Mon, 25 Mar 2024 03:17:16 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711361836; cv=pass; d=google.com; s=arc-20160816; b=KRhi3Zj9osAOb2JT4AqHY18hloi/UR/HAmU/LkxSWEN7hfCSpplOwQzV2kZEfsDlrG GPBFEIsgWGC4KUmz6qpxE+DsP550WABTf6lfuhJEFDuEcTYq8nzzn/uWlCh2gtp018mL UWI6d9URuFp/o1PzzXkHbztYWAZCGkBnXFwINrDqXd1bSEbGDqR/7oms5YZ4Qr9xI3sL rxImqf937sgcEHm56wZ/EmcNRfgOz7ronQU0TwfMnVPLlVMtjWvjEhaiYfcyp0WuHa1C /gnvWg8L7IjO0KE/5V8atkS1aQ1j9hgzrSbjp217+hUD0KncDCEZ1B11sEouDtVQBb7Z dDow== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=XLKCoKh5cuFcsaSb8w0yMRXHk2G5P33Vf9BSmlLP3Iw=; fh=qNZnFsddoXoStLuR43prh0sugzBZQRWUXBvfuohLwEU=; b=Q/VfK1nwDAdp/YXrgfboIM04L5EzzQ/hRgEw4rmrQtrJgzUlQ2zYKgGHgTzGmiGIwc MmmTaOj3pvOKlTUNEnOcAInSfKvugSbU9jt8CZ/7C2f2RlSc0PLrvc1hDd97Mjz3Iusw /T1eAIOv01aN7R+SUiabY1P/2PgY3/6tAI7x3zR3+GUoiIawq8/AextpE6Z+cE7SsF6Z JOo4+zUUGa9EAOJtxoYupyRBaHbHQask5Dmy+xj177TmMjmkWAVR8A2pvLmrza7dWoSG Cbxfs1iCtN6h1IMz0dcQLZvxammGqwQrB74IPHFqNrwgTeQgMmE0H/LNFRHfsgu6iHLl KP/w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=a4EkFEyr; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-115985-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-115985-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id q37-20020a631f65000000b005cee9118a7asi7163783pgm.600.2024.03.25.03.17.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 03:17:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-115985-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=a4EkFEyr; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-115985-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-115985-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 00E7829F85A for ; Mon, 25 Mar 2024 09:59:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 07F20268CE8; Mon, 25 Mar 2024 03:05:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="a4EkFEyr" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 347E115ECEA; Sun, 24 Mar 2024 23:18:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711322312; cv=none; b=WOhiMhWWRgWA+NOE+dJ5YNX2cTYwUT0anKUxRlFhufsV+ZQ8o6321UK9h4XWjqNI4JpYpTfq+BUu0VNB1ijq+7WNwFf0SpjRTk7P/6Qo2FLaac9e+Sr5pSqtM/S6au5d9Pn3+AD+ls9cxhXptCccdW/j6FP9KsK09qF1RYD0kuA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711322312; c=relaxed/simple; bh=vYDrj65XbguCNZEvMXtOEcXUTXcfMV3g0dkmYc1mhQ8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fUuj6vusmzNFheW4G0tcfdTN1SBV01F/EMlLuHQCoU+Y/I4YL9Zgsbgsc+ZDmE0VJT61NmzjS9q2ijfafJK+w/XISOlFiDbc/Ar8CzWFjTeWlE81YmN1GU67Q6BQMmKQtYSqOiRVNt42eGDUXSUstWSTC1cCHsfeU+ArV+tQ/A4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=a4EkFEyr; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4746DC433F1; Sun, 24 Mar 2024 23:18:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711322310; bh=vYDrj65XbguCNZEvMXtOEcXUTXcfMV3g0dkmYc1mhQ8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=a4EkFEyrQJ7BPmVgFFuKRvBrNolcvOb1SmXbMLacN1dOtKqyYSwXQDx1y2dkebRUQ azMM4lGRlVM6RKkg5Q7w1Vtjfo47L/TmXkA5GyuWu76ILZNQhYhEcM6wCAmLqUfIxX vB7UbVhN1MsFLRD/4ZDLodY9Kscq60wC4F06NIE34QrcHJHutUK2xJ8Wsw7i8P0ziq MYZLtNqvDYFJoFl2mas64QjcC/6B8eouCPZzoGrFUoMuTXIz9gKhFdhpHJo6XHzAXv dDdarFAtqOIuccN06Yh8R125Nl5avCTk39XffASImasEGhu3BCEb0nfsv/66URQouN McIH4YjD7G19A== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Masahiro Yamada , Sasha Levin Subject: [PATCH 6.1 394/451] kconfig: fix infinite loop when expanding a macro at the end of file Date: Sun, 24 Mar 2024 19:11:10 -0400 Message-ID: <20240324231207.1351418-395-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324231207.1351418-1-sashal@kernel.org> References: <20240324231207.1351418-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit From: Masahiro Yamada [ Upstream commit af8bbce92044dc58e4cc039ab94ee5d470a621f5 ] A macro placed at the end of a file with no newline causes an infinite loop. [Test Kconfig] $(info,hello) \ No newline at end of file I realized that flex-provided input() returns 0 instead of EOF when it reaches the end of a file. Fixes: 104daea149c4 ("kconfig: reference environment variables directly and remove 'option env='") Signed-off-by: Masahiro Yamada Signed-off-by: Sasha Levin --- scripts/kconfig/lexer.l | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/scripts/kconfig/lexer.l b/scripts/kconfig/lexer.l index cc386e4436834..2c2b3e6f248ca 100644 --- a/scripts/kconfig/lexer.l +++ b/scripts/kconfig/lexer.l @@ -302,8 +302,11 @@ static char *expand_token(const char *in, size_t n) new_string(); append_string(in, n); - /* get the whole line because we do not know the end of token. */ - while ((c = input()) != EOF) { + /* + * get the whole line because we do not know the end of token. + * input() returns 0 (not EOF!) when it reachs the end of file. + */ + while ((c = input()) != 0) { if (c == '\n') { unput(c); break; -- 2.43.0