From patchwork Wed Feb 18 13:51:41 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 44771 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f198.google.com (mail-lb0-f198.google.com [209.85.217.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id D0E3C21544 for ; Wed, 18 Feb 2015 13:52:05 +0000 (UTC) Received: by lbvp9 with SMTP id p9sf892589lbv.1 for ; Wed, 18 Feb 2015 05:52:04 -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=XX0s2MF1vezQ8gotWkP5JbWnNP7an4k5j3b3c+1NYbQ=; b=Mge1dpslDNa/5mZPbQlFSSSl19rCaDt1Sd9HyHLLOiDQAWQsF2jBg/6cOA3VpbN3k/ j3NTtR+n9293Qf+F+81zLss0Qn3Jrfg2GcN8Ei9t1YET83BYSd1dR3BAOUegUZud2Y2j b4zVLH8mVh3ZMjOcx8TBcuG2cqOGEW9TPutnaRBngCPdsCbpbifmHNQy0WgVL3/BsMQO qbU6DhAzA123H65/v8kQDv4DQ1qO4pwma3Fa1tAMnoA6MuP8GH43+vpvB89/Qo+dq+Cu 0hJdkCrzRbsNB27xHUgbIu/hFQ8i8Vo0XB2XYtKYBH6iaHop/NWDc9HY5RLqvcr63JBW z1IA== X-Gm-Message-State: ALoCoQnG//NyOfKc8TyIBWPWgXN15RSrk5YSkFAtnNpqaSUomKikFSz6g71g21aK0EFOvIfUO1ws X-Received: by 10.194.221.65 with SMTP id qc1mr4290984wjc.7.1424267524658; Wed, 18 Feb 2015 05:52:04 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.27.40 with SMTP id q8ls23373lag.29.gmail; Wed, 18 Feb 2015 05:52:04 -0800 (PST) X-Received: by 10.152.183.165 with SMTP id en5mr23331502lac.0.1424267524464; Wed, 18 Feb 2015 05:52:04 -0800 (PST) Received: from mail-lb0-f169.google.com (mail-lb0-f169.google.com. [209.85.217.169]) by mx.google.com with ESMTPS id zy1si13157858lbb.12.2015.02.18.05.52.03 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Feb 2015 05:52:03 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.169 as permitted sender) client-ip=209.85.217.169; Received: by lbiw7 with SMTP id w7so1161257lbi.9 for ; Wed, 18 Feb 2015 05:52:03 -0800 (PST) X-Received: by 10.152.26.199 with SMTP id n7mr33311042lag.29.1424267523800; Wed, 18 Feb 2015 05:52:03 -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 h5csp2861850lbj; Wed, 18 Feb 2015 05:52:03 -0800 (PST) X-Received: by 10.68.69.110 with SMTP id d14mr58065904pbu.3.1424267522046; Wed, 18 Feb 2015 05:52:02 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id be6si13530565pbd.160.2015.02.18.05.52.01; Wed, 18 Feb 2015 05:52:02 -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 S1751980AbbBRNv5 (ORCPT + 28 others); Wed, 18 Feb 2015 08:51:57 -0500 Received: from mail-la0-f51.google.com ([209.85.215.51]:43366 "EHLO mail-la0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751103AbbBRNv4 (ORCPT ); Wed, 18 Feb 2015 08:51:56 -0500 Received: by labms9 with SMTP id ms9so1179127lab.10 for ; Wed, 18 Feb 2015 05:51:55 -0800 (PST) X-Received: by 10.112.92.204 with SMTP id co12mr33561735lbb.43.1424267515202; Wed, 18 Feb 2015 05:51:55 -0800 (PST) Received: from khorivan.itg.ti.com (32-55-93-178.pool.ukrtel.net. [178.93.55.32]) by mx.google.com with ESMTPSA id p5sm4206402laj.0.2015.02.18.05.51.52 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 18 Feb 2015 05:51:53 -0800 (PST) From: Ivan Khoronzhuk To: matt.fleming@intel.com Cc: linux-kernel@vger.kernel.org, ard.biesheuvel@linaro.org, leif.lindholm@linaro.org, Ivan Khoronzhuk Subject: [Patch v3] firmware: dmi_scan: fix dmi scan to handle "End of Table" structure Date: Wed, 18 Feb 2015 15:51:41 +0200 Message-Id: <1424267501-27172-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.169 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 fc43026278b2 (dmi: add support for SMBIOS 3.0 64-bit entry point) the 127-0 entry is not handled any more, as result it's not created in dmi sysfs for instance. This is important because the size of whole DMI table must correspond to sum of all DMI entry sizes. So move the end-of-table check after it's handled by dmi_table. Reviewed-by: Ard Biesheuvel Signed-off-by: Ivan Khoronzhuk --- v3..v2: Include regression commit in commit msg 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++; }