From patchwork Thu Sep 28 04:02:20 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Limonciello, Mario" X-Patchwork-Id: 9975269 X-Patchwork-Delegate: dvhart@infradead.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 33D9160365 for ; Thu, 28 Sep 2017 04:03:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 24ACE2942E for ; Thu, 28 Sep 2017 04:03:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 197102943A; Thu, 28 Sep 2017 04:03:09 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D43742942E for ; Thu, 28 Sep 2017 04:03:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751088AbdI1ECz (ORCPT ); Thu, 28 Sep 2017 00:02:55 -0400 Received: from esa7.dell-outbound.iphmx.com ([68.232.153.96]:10881 "EHLO esa7.dell-outbound.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751356AbdI1ECa (ORCPT ); Thu, 28 Sep 2017 00:02:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=dell.com; i=@dell.com; q=dns/txt; s=smtpout; t=1506570841; x=1538106841; h=from:to:cc:subject:date:message-id; bh=0icsuKVDq0YG8ouPVRFZtWVCvq/VkjPdB5pJpl9bBPU=; b=atKHGBC7ljYOFUdb3fHHhDcpgJDtDCcXD8iMiHRdiD2eGa1Hv9+I4Pry qVydc77PooFwn678Z1DDkN2I60LavPF1SrhgtsBCFDySuiKlKXzHt1fRJ hGAqCMQhZFju3wWcyMjZ7H2OiGP2NyBsxt1D4ob1FBresaChYrP+9MM+h w=; Received: from esa1.dell-outbound2.iphmx.com ([68.232.153.201]) by esa7.dell-outbound.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 Sep 2017 22:54:00 -0500 Received: from ausxipps310.us.dell.com ([143.166.148.211]) by esa1.dell-outbound2.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 Sep 2017 10:00:21 +0600 X-LoopCount0: from 10.208.86.39 X-IronPort-AV: E=Sophos;i="5.42,448,1500958800"; d="scan'208";a="66774564" X-DLP: DLP_GlobalPCIDSS From: Mario Limonciello To: dvhart@infradead.org, Andy Shevchenko Cc: LKML , platform-driver-x86@vger.kernel.org, Andy Lutomirski , quasisec@google.com, pali.rohar@gmail.com, Mario Limonciello Subject: [PATCH v3 8/8] platform/x86: dell-wmi-smbios: clean up wmi descriptor check Date: Wed, 27 Sep 2017 23:02:20 -0500 Message-Id: <84b6170a1d3a692b53a40f795dd4f9a3052b8fe3.1506571188.git.mario.limonciello@dell.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: References: In-Reply-To: References: Sender: platform-driver-x86-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: platform-driver-x86@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Some cases the wrong type was used for errors and checks can be done more cleanly. Signed-off-by: Mario Limonciello Reviewed-by: Edward O'Callaghan --- drivers/platform/x86/dell-smbios.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/platform/x86/dell-smbios.c b/drivers/platform/x86/dell-smbios.c index ac176953e46e..d75b6971588e 100644 --- a/drivers/platform/x86/dell-smbios.c +++ b/drivers/platform/x86/dell-smbios.c @@ -346,16 +346,16 @@ int dell_wmi_check_descriptor_buffer(struct wmi_device *wdev, u32 *version) } desc_buffer = (u32 *)obj->buffer.pointer; - if (desc_buffer[0] != 0x4C4C4544 && desc_buffer[1] != 0x494D5720) - dev_warn(&wdev->dev, "Dell descriptor buffer has invalid signature (%*ph)\n", - 8, desc_buffer); + if (strncmp(obj->string.pointer, "DELL WMI", 8) != 0) + dev_warn(&wdev->dev, "Dell descriptor buffer has invalid signature (%8ph)\n", + desc_buffer); if (desc_buffer[2] != 0 && desc_buffer[2] != 1) - dev_warn(&wdev->dev, "Dell descriptor buffer has unknown version (%d)\n", + dev_warn(&wdev->dev, "Dell descriptor buffer has unknown version (%u)\n", desc_buffer[2]); if (desc_buffer[3] != 4096) - dev_warn(&wdev->dev, "Dell descriptor buffer has invalid buffer length (%d)\n", + dev_warn(&wdev->dev, "Dell descriptor buffer has invalid buffer length (%u)\n", desc_buffer[3]); *version = desc_buffer[2];