Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp608484pxb; Mon, 25 Oct 2021 14:53:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzNF+96OqIMmAZ5mtpyIHh6ClWaSmvYCZhSWS7OEA3McY0IIJ9vYwAKi7C/NTDsy+RNM5KY X-Received: by 2002:a17:90a:8b01:: with SMTP id y1mr23514687pjn.225.1635198808989; Mon, 25 Oct 2021 14:53:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635198808; cv=none; d=google.com; s=arc-20160816; b=RtA091AoDiDGs2xGnyxzBs5GFrmCdObxd3waBt7kkv4K4BCi0uY+bt1S5VctHBZjWg oEtb5BdbwmvmkGMWrZcy25/uUxwryTyhIARM9LTk5miphJNICPUVKFXgE8cXBiaJ2qe7 NyRU4bf3H8Cdl3KXVkVV2MOMYTtvizfXbEzvLI7u/BzGTCUs8A7kGntDMMqLfL8oA0Xz CaRCKM9nSO7ROXI816kqoYrh9xseyu4YFcnEt5PitYecsH88LxaickJRgQ1tz6yJWqKt YNWMneYO2/x/G/F3BWsTEvW+JDokMqluGQ9XQtZvUwQpSCqfpF8hDU2e+JnHjDWVKa7E HrkA== 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=P8ZE21TU4fypAjhkzcc/qsvHEHUKo6c1+3tUk+Ujino=; b=mB46Heo29jyLgF9sJ3vzZPaUeO+cPQU/V3I4nJH6VvOBoHAOVYI5wi+03B4AvpoFJh Jc356h4RS9AO6uEmWEeQdDBkwF0PgzYd5I/9hXRvl8SzBSpbnKw3oS5dOKq7BwCssrJ8 /UvZtfzb9KqfFUrq3Eqmq9iChJP1EwZbhy0IpyaL4DO/EWRuUGann7MnFI1tXws38Oxi 2WDonodzfpvf1Cf702VSj1+9r8lo5X1zSIYwxwhBqCpdljD8TzgHJHww1iDQFTszALV1 rDjG7PXaVrtbo9YOHYAPzchd3Y/JqmzVbmX/Y8/YPqfjP1LltjD9N+C8Mc3JnlJ2TtXR 3Ocg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=gm257RKY; 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 w185si22582418pfb.340.2021.10.25.14.53.16; Mon, 25 Oct 2021 14:53:28 -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=gm257RKY; 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 S234316AbhJYTSm (ORCPT + 99 others); Mon, 25 Oct 2021 15:18:42 -0400 Received: from mail.kernel.org ([198.145.29.99]:36070 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234515AbhJYTSW (ORCPT ); Mon, 25 Oct 2021 15:18:22 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 11461600D3; Mon, 25 Oct 2021 19:15:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1635189360; bh=T6sqSzknxN+29LWj2D1Fygfur49sOyVzp9bbeAszR4U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gm257RKYABfD0F9AGRwgRG0DoPC2NXdj+HGkG6hedWPaSu+GqSgIqCILwQ8KHYIMp zv6gisiOX22E9fo2+MEK9VinnnQXvl/kD3GX08vCwi2vJ7TzPWZIpLEVsK7KBn57zT peCucoCrusnYvqVkXB1LP4b7Jft4N32nAl/Q6TEU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Joe Perches , Ard Biesheuvel Subject: [PATCH 4.4 05/44] efi/cper: use stack buffer for error record decoding Date: Mon, 25 Oct 2021 21:13:46 +0200 Message-Id: <20211025190929.800977864@linuxfoundation.org> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211025190928.054676643@linuxfoundation.org> References: <20211025190928.054676643@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 @@ -35,8 +35,6 @@ #define INDENT_SP " " -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 @@ -293,6 +291,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); @@ -307,6 +306,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) &&