Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3028062pxb; Mon, 18 Oct 2021 06:54:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyM4ENd1YsrrevN/RrDKKXyvnKweqh4+QWSWyys8DTnsrswnfbO1ZtNlS4J0E1q8cD0k07J X-Received: by 2002:a63:d64c:: with SMTP id d12mr24184848pgj.186.1634565298063; Mon, 18 Oct 2021 06:54:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634565298; cv=none; d=google.com; s=arc-20160816; b=tsDoDb6Gh/iLPRVwn6tMY0IqJWlvqzMN8yvVIhG5cm6TKU9/mgWUK902ocClYjb6kP N/k+Va/Z2g8MyYd1OtGlPD7f2M4yW8XFESl3UnjFeMX2DMq3WqYeM4TlWz6FncUttAoL WpsbMEay3heDgUo/bu3tdssdRSmwltjzuGIi8ZLdMwSNrgN3mXQXb/PeCAb4X/JrThhS DdWoNNuR901cHp2zc87/qRyRTgSCQul1b58icjqp3Ly0U8Rt43TVlzeleOeU0vIWIW+7 8tHR9ZC4DZxz9mWLQjRgF+9jfSsli3l/xokqbxQrke6zegvFRI4Wb0ns9Q/2JUod0hPy 1IHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Sac+m0fx+7k4WZ94jwKvuv4auOl+OkU94+asYa6Bdtg=; b=tTrI0bjDb7mFUBG1JpqgrUmo3fbGBj3XkcPGWSpGgpWcVU45um1Oc2nuM52Q1RlJdE nQW2MLtF7FEJMnzoiCapQWj6S+3nCQeggxXOXU4XEYNyB7ZaWX9NCSrcaWZntYDcSFYH 7DkMmpXkQw8HS/aCLyEZc8gsWGjqCdjD1nVvCJjE0MudcuqYczXl+xhdr7q2bqxlxxCL GL/ARn6QAI48YLEeUv/u3VGBnKU7ccEhYSmYc2oB8iLuaz97Ico0fDUr8RLQuse0pya/ ocVcsoWuGqVK/8Atzt+B1UWOSWDQpjcsj4cdBSyXeg145T6eBWOkLQdfMnjCTl0OoDTO DQMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=19AmSyPM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z6si26448467pjq.23.2021.10.18.06.54.44; Mon, 18 Oct 2021 06:54:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=19AmSyPM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233928AbhJRNyi (ORCPT + 99 others); Mon, 18 Oct 2021 09:54:38 -0400 Received: from mail.kernel.org ([198.145.29.99]:56112 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233868AbhJRNwF (ORCPT ); Mon, 18 Oct 2021 09:52:05 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id B80D36137C; Mon, 18 Oct 2021 13:38:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1634564322; bh=b3aGtohO717TSNZ0ihvaEzIUwQ0LZ7WFoe7mE075hAY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=19AmSyPMpqJfpNBdWL8aQZJ22FrH2UXhQlrF2GMN7Q007qJzIdb0uOWEZ62WDREfL 8ryZQrUzV3yNGv6cwIlF3mqjqqvNucit685tbH1MKH6F4iqHStSAMPNypIyBIHnprd MFEH6GXsKPoVrdAbMmt/3bQifrrZlhGmzePwSfl4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Joe Perches , Ard Biesheuvel Subject: [PATCH 5.14 046/151] efi/cper: use stack buffer for error record decoding Date: Mon, 18 Oct 2021 15:23:45 +0200 Message-Id: <20211018132342.199309377@linuxfoundation.org> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211018132340.682786018@linuxfoundation.org> References: <20211018132340.682786018@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ard Biesheuvel commit b3a72ca80351917cc23f9e24c35f3c3979d3c121 upstream. Joe reports that using a statically allocated buffer for converting CPER error records into human readable text is probably a bad idea. Even though we are not aware of any actual issues, a stack buffer is clearly a better choice here anyway, so let's move the buffer into the stack frames of the two functions that refer to it. Cc: Reported-by: Joe Perches Signed-off-by: Ard Biesheuvel Signed-off-by: Greg Kroah-Hartman --- drivers/firmware/efi/cper.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/firmware/efi/cper.c +++ b/drivers/firmware/efi/cper.c @@ -25,8 +25,6 @@ #include #include -static char rcd_decode_str[CPER_REC_LEN]; - /* * CPER record ID need to be unique even after reboot, because record * ID is used as index for ERST storage, while CPER records from @@ -313,6 +311,7 @@ const char *cper_mem_err_unpack(struct t struct cper_mem_err_compact *cmem) { const char *ret = trace_seq_buffer_ptr(p); + char rcd_decode_str[CPER_REC_LEN]; if (cper_mem_err_location(cmem, rcd_decode_str)) trace_seq_printf(p, "%s", rcd_decode_str); @@ -327,6 +326,7 @@ static void cper_print_mem(const char *p int len) { struct cper_mem_err_compact cmem; + char rcd_decode_str[CPER_REC_LEN]; /* Don't trust UEFI 2.1/2.2 structure with bad validation bits */ if (len == sizeof(struct cper_sec_mem_err_old) &&