From patchwork Wed Nov 2 21:23:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Armin Wolf X-Patchwork-Id: 14491 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp151735wru; Wed, 2 Nov 2022 14:28:24 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5Nc8SJkLyGGpGBjPxTW0uQyjUmTC+ayF3s8LOJXc3vdkabppoF81twikYQ3S8lk8/QZ6OY X-Received: by 2002:a62:ea0d:0:b0:55f:8624:4d8b with SMTP id t13-20020a62ea0d000000b0055f86244d8bmr26891088pfh.74.1667424504502; Wed, 02 Nov 2022 14:28:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667424504; cv=none; d=google.com; s=arc-20160816; b=CAURPvwOvstjkqtgDPD6iATR+9nOcqBpkoY3eAw7UvUKzPfA/kFnAXrGLnaDINzRO2 z6eo0y20LwiZasP4ixPHeu3K13fV/ooHv6cFab5tw/XWeL9r98ln6qAMaujqzn9CT5BL DhWpEe7xIsiGp6TlernAGNYE7LpxdvnuT0UvQeuw38w9Vekzhe6mpCpG2wj46/zjORDz NF3ugiT8BVrkBoQCdCXbKr08IDMSkv7tvKKadeR3EOaLomil0oJ6TGMclWJwnNOOUmaX D8Z+D7uGy8iiQFWq+oQ1QgSy0e3QRBThbSvpJuveqfCrXeZL289l0iMpEOgq/LBorCNH LXfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:ui-outboundreport:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=tIsOYcjbCtp6C9LBcTW33xqwACdZ4GOrDXAeE6j98gw=; b=rOvf6ASRK78uOyu68x25akLN/3EFE9EbdXdTZ6l8rnCCOrhW5mKDDvIzAZZAqzBlfj Ae+W3e9zJhdRn3X3dGX3gaVKZuwNr6zKYHrA2enhgqofP813qqY+9HZYxLorzeN8B5un Qw44xnc+HbIUcJSDLuZa2dmyHrOXKyiN/zOY6HTCN53y9G5G5leKziH5wdmWzdaGVVh+ dGcHQUl+/fpzdA4DM0d7+wKJt09yFTFMaEVEIccNNuP0JU9sXu2Tde/4GxSpxmYj+Vbv mX1aprQauMw3O6xZZRppq52n0czmeTb66lX3pIYJMon/Y1TMN4vb3WtCL2HvtLl6MpoN wURg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmx.de header.s=s31663417 header.b="anaXfdO/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmx.de Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k17-20020a170902f29100b0018668baa655si14250981plc.280.2022.11.02.14.28.11; Wed, 02 Nov 2022 14:28:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmx.de header.s=s31663417 header.b="anaXfdO/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmx.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231167AbiKBVXy (ORCPT + 99 others); Wed, 2 Nov 2022 17:23:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59404 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229882AbiKBVXu (ORCPT ); Wed, 2 Nov 2022 17:23:50 -0400 Received: from mout.gmx.net (mout.gmx.net [212.227.17.22]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 04A5B3B3; Wed, 2 Nov 2022 14:23:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.de; s=s31663417; t=1667424221; bh=563YttvuumXCAkFcYzDRK3i2GybkAFkEzHBYksZEWqI=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=anaXfdO/64IuThV7el5fQKM6XEYNbXrxkvTzU9lCSvuCyyHwnyKd9o0MYshpj8JP2 +XeGoWCsNbne5eCdIcjJDTQXNtnvRAgXdwordeZ8hjl3xHy4ukpx31VC/qKmbV4W0g w2rYh+p3jT7M5voi9LJvsCpeRSO6QiAHy0lFH7/2aH2R+KN5FnyRk36rXO3fq04Qn6 OTLaWIFMuUy+TUXZYtKN87R0wwFELtyDYMndzOCfJgU7uYTzwF2Fytkrwjkq/PW2U5 1YY1hmpSM4LyWoBfYrWHLGX0y7HLkXY32A6egrTahuYkKE8+lh8CQ5Z0b3vYA8ieZ5 PcC5jWZ6f4ZQg== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from esprimo-mx.users.agdsn.de ([141.30.226.129]) by mail.gmx.net (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MrhUK-1pM77w3KIW-00niY3; Wed, 02 Nov 2022 22:23:40 +0100 From: Armin Wolf To: hdegoede@redhat.com, markgross@kernel.org Cc: platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/2] platform/x86: dell-ddv: Warn if ePPID has a suspicious length Date: Wed, 2 Nov 2022 22:23:36 +0100 Message-Id: <20221102212336.380257-2-W_Armin@gmx.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221102212336.380257-1-W_Armin@gmx.de> References: <20221102212336.380257-1-W_Armin@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:bPHFCUaFM4G5bc43gyqGc0rmvo24NZRgRlCSd6py95bDNiEWccD opHe4nHaVq/OJ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ey0RNir/zR chSjOLeejtNbpgn4jY9MmalFF8j9B66LOw+LJFOYHYyo10RCmuagHXqyVU6p0Hi8cPMcgAMiR F3x0ulRF2V0cQJbB7vCIvUFKIF4= X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748421317524166315?= X-GMAIL-MSGID: =?utf-8?q?1748421317524166315?= On some systems (like the Dell Inspiron 3505), the acpi operation region holding the ePPID string is two bytes too short, causing acpi functions like ToString() to omit the last two bytes. This does not happen on Windows, supposedly due to their implementation of ToString() ignoring buffer boundaries. Inform users if the ePPID length differs from the Dell specification so they can complain to Dell to fix their BIOS. Tested on a Dell Inspiron 3505. Signed-off-by: Armin Wolf --- drivers/platform/x86/dell/dell-wmi-ddv.c | 9 +++++++++ 1 file changed, 9 insertions(+) -- 2.30.2 diff --git a/drivers/platform/x86/dell/dell-wmi-ddv.c b/drivers/platform/x86/dell/dell-wmi-ddv.c index 1a001296e8c6..2bb449845d14 100644 --- a/drivers/platform/x86/dell/dell-wmi-ddv.c +++ b/drivers/platform/x86/dell/dell-wmi-ddv.c @@ -10,12 +10,14 @@ #include #include #include +#include #include #include #include #include #include #include +#include #include #include #include @@ -27,6 +29,9 @@ #define DELL_DDV_SUPPORTED_INTERFACE 2 #define DELL_DDV_GUID "8A42EA14-4F2A-FD45-6422-0087F7A7E608" +#define DELL_EPPID_LENGTH 20 +#define DELL_EPPID_EXT_LENGTH 23 + enum dell_ddv_method { DELL_DDV_BATTERY_DESIGN_CAPACITY = 0x01, DELL_DDV_BATTERY_FULL_CHARGE_CAPACITY = 0x02, @@ -196,6 +201,10 @@ static ssize_t eppid_show(struct device *dev, struct device_attribute *attr, cha if (ret < 0) return ret; + if (obj->string.length != DELL_EPPID_LENGTH && obj->string.length != DELL_EPPID_EXT_LENGTH) + dev_info_once(&data->wdev->dev, FW_INFO "Suspicious ePPID length (%d)\n", + obj->string.length); + ret = sysfs_emit(buf, "%s\n", obj->string.pointer); kfree(obj);