From patchwork Wed Mar 4 10:48:35 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chun-Yi Lee X-Patchwork-Id: 5935341 X-Patchwork-Delegate: rjw@sisk.pl Return-Path: X-Original-To: patchwork-linux-acpi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id C0D3EBF440 for ; Wed, 4 Mar 2015 10:49:21 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EBC0C20256 for ; Wed, 4 Mar 2015 10:49:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CA4222012E for ; Wed, 4 Mar 2015 10:49:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933070AbbCDKtS (ORCPT ); Wed, 4 Mar 2015 05:49:18 -0500 Received: from mail-pa0-f44.google.com ([209.85.220.44]:36575 "EHLO mail-pa0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933064AbbCDKtR (ORCPT ); Wed, 4 Mar 2015 05:49:17 -0500 Received: by padfa1 with SMTP id fa1so26367893pad.3; Wed, 04 Mar 2015 02:49:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=Ryp8WdZ7BsWExl9XRgPeD7FYEza9qr+xlcwtwID+tps=; b=aAturFv7VWMPJ69GDUEZs/5vUQWfxz2tGFfM79F5qmUOi+UHmuCaVq2C3XkSjvVkWg K+7cK99lI57PiINpM8ql+mnto5AkH2bdYwVP6KAsxF8//Qf3e9BxaKl0CDWnNmbiSk0+ x1sX87+lPWQRTtvN2hxlR+1UOPMQfAxWnPmXoexRxjC8nXIZJsAFYiuXD/zL2n7GmO6z 1oVqeFyRkxb0lTi8APu64Bwh1InGUTffhz35Qf9G9pWvSBA2450n11TKSgrE/boZoG5q w2sN7qVgHU2LOtM8k6NIiJbj2JHZ0CUgZXhZP/j5XORXBcndoy0kymhnxb2yXCLr4WX8 y/dg== X-Received: by 10.68.125.164 with SMTP id mr4mr5648869pbb.27.1425466156737; Wed, 04 Mar 2015 02:49:16 -0800 (PST) Received: from linux-rxt1.site ([130.57.30.250]) by mx.google.com with ESMTPSA id gf9sm3554172pbd.95.2015.03.04.02.49.10 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 04 Mar 2015 02:49:15 -0800 (PST) From: "Lee, Chun-Yi" X-Google-Original-From: "Lee, Chun-Yi" To: "Rafael J. Wysocki" Cc: linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, "Lee, Chun-Yi" , Len Brown , Thomas Renninger , Nan Li Subject: [PATCH] acpi: The count field of counter_show() function should be an unsigned value Date: Wed, 4 Mar 2015 18:48:35 +0800 Message-Id: <1425466115-26306-1-git-send-email-jlee@suse.com> X-Mailer: git-send-email 1.8.4.5 Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Nan Li The count field is an unsigned 32bit value, and the counter_show() function should also treat it as a unsigned value. Otherwise the counter may show negative number as we found on a machine: ... gpe23: 0 invalid gpe24: -2071733 enabled gpe25: 0 invalid ... gpe_all: -2070980 sci: -2070949 Cc: "Rafael J. Wysocki" Cc: Len Brown Cc: Thomas Renninger Signed-off-by: Nan Li Signed-off-by: Lee, Chun-Yi --- drivers/acpi/sysfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/acpi/sysfs.c b/drivers/acpi/sysfs.c index 13e577c..0876d77 100644 --- a/drivers/acpi/sysfs.c +++ b/drivers/acpi/sysfs.c @@ -527,7 +527,7 @@ static ssize_t counter_show(struct kobject *kobj, acpi_irq_not_handled; all_counters[num_gpes + ACPI_NUM_FIXED_EVENTS + COUNT_GPE].count = acpi_gpe_count; - size = sprintf(buf, "%8d", all_counters[index].count); + size = sprintf(buf, "%8u", all_counters[index].count); /* "gpe_all" or "sci" */ if (index >= num_gpes + ACPI_NUM_FIXED_EVENTS)