From patchwork Wed Feb 4 14:22:05 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 44372 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-we0-f200.google.com (mail-we0-f200.google.com [74.125.82.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 7BE0C2029F for ; Wed, 4 Feb 2015 14:22:33 +0000 (UTC) Received: by mail-we0-f200.google.com with SMTP id m14sf1538756wev.3 for ; Wed, 04 Feb 2015 06:22:32 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=D4IcNWlhbVjUPNq+YJzMq9OvOTc0o450TRl7o+GGZrE=; b=YNn1VN3zJrjbpqO83AMZNASZrCYcYqJGJk4gq8MT95jiaJNuHJnL7Zw2LOirxBbu1/ hbrMAwGGQ54nHXV8y5GirXWxVQLaQtcqGWhhMfojDgR2U9LEAW5JvC2OSN3BdTT2jtif X7lb7ROhZFkpeq+m2mSG+e1kMhDkq5U+t1xHZd9ZW12nVRbZHsXyb7Y0ZDucKMB+9ky1 mUIX96I9fKn6E25WfWJUPxry9sE2wm27UXtYGCTFz7WKQAKvYw0/0GniAtDBv6AQFoCL H2o6oCLuDCK9c+nUUvNixvYxpPuFugcD91Y1zUpFaNkzkU8SH6vncjCi2E04CsH6KmZL ZgSg== X-Gm-Message-State: ALoCoQnBUKJCEvVo2fgNiUqltxkJSLxEbeZ/y0YsAWACwdXPU1QhWkzUkEsQLg5SoTiRetPVT5OG X-Received: by 10.152.219.136 with SMTP id po8mr3915064lac.4.1423059752586; Wed, 04 Feb 2015 06:22:32 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.234.5 with SMTP id ua5ls33347lac.68.gmail; Wed, 04 Feb 2015 06:22:32 -0800 (PST) X-Received: by 10.112.12.71 with SMTP id w7mr20556342lbb.99.1423059752347; Wed, 04 Feb 2015 06:22:32 -0800 (PST) Received: from mail-lb0-f174.google.com (mail-lb0-f174.google.com. [209.85.217.174]) by mx.google.com with ESMTPS id us19si1485724lbb.35.2015.02.04.06.22.32 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 04 Feb 2015 06:22:32 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.174 as permitted sender) client-ip=209.85.217.174; Received: by mail-lb0-f174.google.com with SMTP id f15so1741629lbj.5 for ; Wed, 04 Feb 2015 06:22:32 -0800 (PST) X-Received: by 10.152.7.229 with SMTP id m5mr31110331laa.80.1423059752172; Wed, 04 Feb 2015 06:22:32 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.35.133 with SMTP id h5csp518248lbj; Wed, 4 Feb 2015 06:22:31 -0800 (PST) X-Received: by 10.66.65.203 with SMTP id z11mr9540650pas.99.1423059750286; Wed, 04 Feb 2015 06:22:30 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id yc6si2428705pbc.16.2015.02.04.06.22.29; Wed, 04 Feb 2015 06:22:30 -0800 (PST) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965958AbbBDOW0 (ORCPT + 29 others); Wed, 4 Feb 2015 09:22:26 -0500 Received: from mail-la0-f42.google.com ([209.85.215.42]:34916 "EHLO mail-la0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964854AbbBDOWX (ORCPT ); Wed, 4 Feb 2015 09:22:23 -0500 Received: by mail-la0-f42.google.com with SMTP id ms9so1838330lab.1 for ; Wed, 04 Feb 2015 06:22:21 -0800 (PST) X-Received: by 10.112.78.39 with SMTP id y7mr9484171lbw.58.1423059741766; Wed, 04 Feb 2015 06:22:21 -0800 (PST) Received: from khorivan.itg.ti.com (152-172-94-178.pool.ukrtel.net. [178.94.172.152]) by mx.google.com with ESMTPSA id x9sm384398lbb.46.2015.02.04.06.22.19 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 04 Feb 2015 06:22:20 -0800 (PST) From: Ivan Khoronzhuk To: linux-kernel@vger.kernel.org, matt.fleming@intel.com, ard.biesheuvel@linaro.org Cc: leif.lindholm@linaro.org, Ivan Khoronzhuk Subject: [Patch v2] firmware: dmi_scan: fix dmi scan to handle "End of Table" structure Date: Wed, 4 Feb 2015 16:22:05 +0200 Message-Id: <1423059725-5448-1-git-send-email-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ivan.khoronzhuk@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.174 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , The dmi-sysfs should create "End of Table" entry, that is type 127. But after adding initial SMBIOS v3 support the 127-0 entry is not handled any more, as result it's not created in sysfs. This is important because the size of whole DMI table must correspond to sum of all DMI entry sizes. So move "end-of-table" check after it's handled by decode. Signed-off-by: Ivan Khoronzhuk Reviewed-by: Ard Biesheuvel --- v2..v1: Move end of table check after it's handled instead of removing Correct commit drivers/firmware/dmi_scan.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/firmware/dmi_scan.c b/drivers/firmware/dmi_scan.c index c5f7b4e..a44b87c 100644 --- a/drivers/firmware/dmi_scan.c +++ b/drivers/firmware/dmi_scan.c @@ -93,12 +93,6 @@ static void dmi_table(u8 *buf, int len, int num, const struct dmi_header *dm = (const struct dmi_header *)data; /* - * 7.45 End-of-Table (Type 127) [SMBIOS reference spec v3.0.0] - */ - if (dm->type == DMI_ENTRY_END_OF_TABLE) - break; - - /* * We want to know the total length (formatted area and * strings) before decoding to make sure we won't run off the * table in dmi_decode or dmi_string @@ -108,6 +102,13 @@ static void dmi_table(u8 *buf, int len, int num, data++; if (data - buf < len - 1) decode(dm, private_data); + + /* + * 7.45 End-of-Table (Type 127) [SMBIOS reference spec v3.0.0] + */ + if (dm->type == DMI_ENTRY_END_OF_TABLE) + break; + data += 2; i++; }