Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp1352799pxb; Fri, 27 Aug 2021 07:07:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwO5A3OCxqq3OCZQ3TlJLpCxYqlKwKwL4Nd15EKai0rcKtxYXRxqAD4bQVZDv/N9lUky2Ww X-Received: by 2002:aa7:ccda:: with SMTP id y26mr2599927edt.245.1630073267539; Fri, 27 Aug 2021 07:07:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630073267; cv=none; d=google.com; s=arc-20160816; b=Z1lidOn6jagvQ1ceqNJllVGm0xw5J7ZtiH/rms8ebBWWW2HPPNSr94uArk3FhiAd4H 7q7EHzNXwiPB5ojM6NcqUBu0nHJsFkFEf9G5YS66W8tPtYMLxt+MixVcFQW2VJOabu80 zmAe67I2SSADtLXxDRdNqdI1zkVX+BXGU2fifWwt7JvQkbrf5Z5fgbkPpRuZh3hZNmwD WVUiSJXjUfWrpkoDB3KUkgm5TKR/MMsLAOVgZt+irjgqRBd9jOpN7MPzf54vqUO3g1jD j1C6UDhUcafPuN19thrAhxFHDKgUVr5sxmlUTn6RnzD/OyLdXPjuCxb11MmqP2nb8MsV TI9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=kJP8/tDpsj05yxnBkXvkYzj2LBCrPAjVI8tuTJuSgLQ=; b=f7ThcKII+kfBNeisqjfEQYe/IQFHcCbcFfCUfB/EHbPVm378O/mOHj9pKVuhR/Ywzi nIf/7cL6Q8wnPQjt9R0TKbxCB6+snTMAtUVA9ZYgs3ncs4VKdaqUtUreX++71DJvd+dC jsMAtdyVWwuvn/z3GbdluGYgOhEQwEvM6Y/S8HPYXQf6k6MTkucD1A4pNATNVX5ZGjTx qdoK+h/i+crIIb7ifPv/74/NLhriE+6sxnbOjXxHkzlrrjn/ljcXeduuYD7x0dvk7Gfw RMQEM/k2ee3UlTeNE5xjEt0LZelQqfyIiPMlQhMSWXsSWbekkpj6Pr0M1saiKKcCitrQ QlIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=J+6xVaYL; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s19si5683512ejy.541.2021.08.27.07.07.13; Fri, 27 Aug 2021 07:07:47 -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=@kernel.org header.s=k20201202 header.b=J+6xVaYL; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245250AbhH0OF3 (ORCPT + 99 others); Fri, 27 Aug 2021 10:05:29 -0400 Received: from mail.kernel.org ([198.145.29.99]:45976 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244821AbhH0OF3 (ORCPT ); Fri, 27 Aug 2021 10:05:29 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4EF0E60F25; Fri, 27 Aug 2021 14:04:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1630073080; bh=44QU6B7UHXV3vt00RetJeW55g4tXsNAqT+PxKxmKGW0=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=J+6xVaYLfmFda9E6Xfhy0qs0X9nojl1N1jKgKnf29vo2E+t0XQe/kUanKV/z99W84 pbhJQEjZ/EhGQfrsw++H9maezou3hFkMTLrpZ0CzESHMx9i82Qj7XnV+D4JNJRwYQj N3SZ8+FLL+A/ss7yv+7Nx7NTudIU9TiEytsxjEWf28PJzgTBJC8jEtUEGl4rk6hX3U bPtSIpJpRMTu8SL9J2hGmHj6IUwMS2aagl80rOK6yVzU3ER2v3sKfJb28bw8zq8xDU Om3H9oCwJ/EUp7qNtHNCSPpx70MQL7VTi0TfCSNnMXeDZ3cac+a9FQbQ4JkThywhpX cuclQsvrluoNg== Received: by mail-oi1-f180.google.com with SMTP id o185so9608777oih.13; Fri, 27 Aug 2021 07:04:40 -0700 (PDT) X-Gm-Message-State: AOAM533hDtv8pjBeRl8nZJs7FHUeqIQQN8JNGT8VsXLpwQDi2Ide76y7 NGsdNhUMkPIlWjJ2YccmEvYpIKdiFBbUZZpv7cg= X-Received: by 2002:aca:ea54:: with SMTP id i81mr6560180oih.174.1630073079708; Fri, 27 Aug 2021 07:04:39 -0700 (PDT) MIME-Version: 1.0 References: <20210823115654.45405-1-xueshuai@linux.alibaba.com> In-Reply-To: <20210823115654.45405-1-xueshuai@linux.alibaba.com> From: Ard Biesheuvel Date: Fri, 27 Aug 2021 16:04:28 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] efi: cper: check section header more appropriately To: Shuai Xue Cc: linux-efi , Linux Kernel Mailing List , zhangliguang@linux.alibaba.com Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 23 Aug 2021 at 13:57, Shuai Xue wrote: > > When checking a generic status block, we iterate over all the generic data > blocks. The loop condition checks that the generic data block is valid. > Because the size of data blocks (excluding error data) may vary depending > on the revision and the revision is contained within the data block, we > should ensure that enough of the current data block is valid appropiriately > for different revision. > > Signed-off-by: Shuai Xue Applied, thanks. > --- > drivers/firmware/efi/cper.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/firmware/efi/cper.c b/drivers/firmware/efi/cper.c > index e15d484b6a5a..e80706d9e78a 100644 > --- a/drivers/firmware/efi/cper.c > +++ b/drivers/firmware/efi/cper.c > @@ -635,7 +635,7 @@ int cper_estatus_check(const struct acpi_hest_generic_status *estatus) > data_len = estatus->data_length; > > apei_estatus_for_each_section(estatus, gdata) { > - if (sizeof(struct acpi_hest_generic_data) > data_len) > + if (acpi_hest_get_size(gdata) > data_len) > return -EINVAL; > > record_size = acpi_hest_get_record_size(gdata); > -- > 2.20.1.12.g72788fdb >