From mboxrd@z Thu Jan 1 00:00:00 1970 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 018B0248191; Mon, 23 Jun 2025 13:28:58 +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=1750685339; cv=none; b=fhIiKJVW5ulSacbipxT4vnzhszQR0PXZnYQ+nSpDYP5jDWU7+dLtpNPrzFVtW5bifTJBzcX+ebuXARGDy7mK+5wgP1PrJd7qYFsemgpXCA9/XSRzISGExYc/Ag9OSPHN4WkEt7GAuUCFfBoKAhyoaYkKIlQVBV7HcrmPx1xzGJU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750685339; c=relaxed/simple; bh=LIOpDhz1LJs06GTxgStJCg18DFJG+h63wyyJASj8RC8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=eHWM+0QpnUu/k2x5HOC50r3F32vYihLTlsJ3kTzvYFBE4kBA8luS3+51SadSSYpKgD7PLK+/YU9N1CBCOnJYBdcvemRjvkM0hJb6/NiPWF+pkcIKcBotExpzoWlmlg/hweumihzzpfpOFf2pi+s5bjl4y5VU11yPhJ2hGaz2dDQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=gPAg8cvB; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="gPAg8cvB" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8AFABC4CEEA; Mon, 23 Jun 2025 13:28:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1750685338; bh=LIOpDhz1LJs06GTxgStJCg18DFJG+h63wyyJASj8RC8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gPAg8cvBqcaPvy7Jybpfi2WyNNkZ+qBkgyq9+PE8TC1YopMd0FVlnDQlp5OjmU4Kg JEA3+cxKnVSSJ9bwGQ0nGVa+W/QhaAF9HLe7M33bww3mazGkJdwaPTMVv7DqeD9zZv 3s7JfHKVaYDMLKQcEda+zEdteebYqvCqcLLqX/UM= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, "Rafael J. Wysocki" , gldrk , Sasha Levin Subject: [PATCH 6.15 226/592] ACPICA: utilities: Fix overflow check in vsnprintf() Date: Mon, 23 Jun 2025 15:03:04 +0200 Message-ID: <20250623130705.667911199@linuxfoundation.org> X-Mailer: git-send-email 2.50.0 In-Reply-To: <20250623130700.210182694@linuxfoundation.org> References: <20250623130700.210182694@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: gldrk [ Upstream commit 12b660251007e00a3e4d47ec62dbe3a7ace7023e ] ACPICA commit d9d59b7918514ae55063b93f3ec041b1a569bf49 The old version breaks sprintf on 64-bit systems for buffers outside [0..UINT32_MAX]. Link: https://github.com/acpica/acpica/commit/d9d59b79 Signed-off-by: Rafael J. Wysocki Link: https://patch.msgid.link/4994935.GXAFRqVoOG@rjwysocki.net Signed-off-by: gldrk [ rjw: Added the tag from gldrk ] Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin --- drivers/acpi/acpica/utprint.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/acpi/acpica/utprint.c b/drivers/acpi/acpica/utprint.c index 42b30b9f93128..7fad03c5252c3 100644 --- a/drivers/acpi/acpica/utprint.c +++ b/drivers/acpi/acpica/utprint.c @@ -333,11 +333,8 @@ int vsnprintf(char *string, acpi_size size, const char *format, va_list args) pos = string; - if (size != ACPI_UINT32_MAX) { - end = string + size; - } else { - end = ACPI_CAST_PTR(char, ACPI_UINT32_MAX); - } + size = ACPI_MIN(size, ACPI_PTR_DIFF(ACPI_MAX_PTR, string)); + end = string + size; for (; *format; ++format) { if (*format != '%') { -- 2.39.5