Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp3913042ybl; Mon, 12 Aug 2019 08:21:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqyVkrnxC7lxg2AV3OjPKtg6ro7V8UvE7DvQbCN0lJkeuvEG1Dc26RRpUC1oYFPPVr9ayHbZ X-Received: by 2002:a62:640c:: with SMTP id y12mr35592286pfb.166.1565623311684; Mon, 12 Aug 2019 08:21:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565623311; cv=none; d=google.com; s=arc-20160816; b=yE47WxyIK36453FOq+dRs/J2joG99TkJV/drygRGDGodWWWkERNCv1j4e1ZHrZvIgV 3DStOSa56otm8mVYPwgs4E6QRNQVGbovxRePr2yBoFIFbgiTA7VpfeVj1mP6RJmTTmFi 1lvRJb/HgylfjmAcsWTpOqy7I/BKlZi4RBCEAv7DbXZRsxlQq59pR0RwuBT1SG6dU7sX r/rmLGIWZ7h3MVRTcRmPCBkMsRy8ZzYWwN0Oohf2RFev80kmdRRwdUdMuw8C3vQsoab9 4r6XsFOwe2rKUAQwAkRiRDPI3L1ShJGzXQ9QT3XSRUBbd1l42HIOBEgyIboywxJ14MZE SrLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=UMUwcjCxzqE/dmDLP1n/O3yo7MPYfXrBlS1+I6zzLWw=; b=GYCWYRhqW+nQO0df6zAUpJjOB0ORbc9q5cBrPm3ldHtaxIix/zwWplpPF5MUYWVa5m Uir/jfzO2pO9c6/zNX4x9k6iS0ntNhrvyPUjKb7dT1AgwOTOcpclaZxwldIbMTzo25Yl Km5YPAkZmzTuYG5hU4SE+Dmk7LqAMJygRZVSD9BlwvYtUeBV7j1nrheK4XJAD6v6bQXY Zhfiy/B19ckbJ4LSAZp7bf6sGbN1A13HX5JCIBE7PppwqTQIJ6siwDQvkejyvub+g4F4 c7AuaR9ICxC6BWbhOWRwhA/KN7gbAZ4+/wP8PGJ4Qy40Xn7LmmugdzNH6/zayJ7zGsFf Ie8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=PCGID3YG; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t26si7510076pfh.275.2019.08.12.08.21.36; Mon, 12 Aug 2019 08:21:51 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=PCGID3YG; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727959AbfHLPUn (ORCPT + 99 others); Mon, 12 Aug 2019 11:20:43 -0400 Received: from mail-ot1-f68.google.com ([209.85.210.68]:40554 "EHLO mail-ot1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727159AbfHLPUj (ORCPT ); Mon, 12 Aug 2019 11:20:39 -0400 Received: by mail-ot1-f68.google.com with SMTP id c34so20129684otb.7; Mon, 12 Aug 2019 08:20:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=UMUwcjCxzqE/dmDLP1n/O3yo7MPYfXrBlS1+I6zzLWw=; b=PCGID3YGhe0d/4V+x61YoEJYzbSjJwEePHz4OktgEZ8vhUK8Rl3A33TbejSTHTtMhe xCgOnrBdkxB7lGH0UrRIyMwT6Q1Eed2lXvGS3wHNLrFQnZALxtHHHcpVZSTeUVQTil6H NshwoPebomZur99lH2uu8Q3yV1BNZzRFzF3lj6x03IAn54d4GMcwHZ1I7zsxMwBOK4Or r/83TrUz57EDH55AnrcJDlzUQSbEnKq77l5v2gVShb8Dw/+oFcXQi4Z2gIFW0DHLPvur S+mdaM6e0JDafW0TXqulK7HKRf2y4zrUVbwUaKNBCtsPfM103ajCLLA2C4juQ8lCRCp5 yuSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=UMUwcjCxzqE/dmDLP1n/O3yo7MPYfXrBlS1+I6zzLWw=; b=WNdFzfnn3nWTo9977ZDYTrWdesb9P5uGODCIbIxOuYfCyErljurPL00ZAMiJ2cV7ZG jXfppsgg9c2/j7ypa5CaF7jwf+cxEx8TJweozoFYbUJybq9u60xTIcHLv/BlQWuUJVt/ HzgE2oPvA76iro3sXkR2Lmhoek5ij/CqIOTJsyGxVVNJuh4hb5fAE0+xWXXu3cG1Tqyt l7OSsjw6fZLe/RDqVvL04iyLyAk4k/BIqmWD3Od8Jq7ArGYLM6HoxdR+CAK/cQLAkMIa 8PDDd9rfqYW4gQpgrjvEx0NZmIb84RBt/3lAmwxJtAtHT9TC+3SutK0QW2xEm8B0NdFM oJog== X-Gm-Message-State: APjAAAWRsckHYa1zT7QKp/KF7Ee5t4lCld2tECrds+ugvhBjxiUq+pwm FgyWU8VW36jrYL8XKx9FhH4= X-Received: by 2002:a9d:200c:: with SMTP id n12mr175723ota.334.1565623239026; Mon, 12 Aug 2019 08:20:39 -0700 (PDT) Received: from localhost.localdomain ([65.154.66.198]) by smtp.gmail.com with ESMTPSA id e10sm31792662oie.37.2019.08.12.08.20.38 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 12 Aug 2019 08:20:38 -0700 (PDT) From: stillcompiling@gmail.com To: Jiri Kosina , Benjamin Tissoires , linux-input@vger.kernel.org (open list:HID CORE LAYER), linux-kernel@vger.kernel.org (open list) Cc: Joe Perches , Joshua Clayton Subject: [PATCH v3 3/3] HID: core: fix dmesg flooding if report field larger than 32bit Date: Mon, 12 Aug 2019 09:20:22 -0600 Message-Id: <20190812152022.27963-4-stillcompiling@gmail.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190812152022.27963-1-stillcompiling@gmail.com> References: <20190812152022.27963-1-stillcompiling@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Joshua Clayton Only warn once of oversize hid report value field On HP spectre x360 convertible the message: hid-sensor-hub 001F:8087:0AC2.0002: hid_field_extract() called with n (192) > 32! (kworker/1:2) is continually printed many times per second, crowding out all else. Protect dmesg by printing the warning only one time. The size of the hid report field data structure should probably be increased. The data structure is treated as a u32 in Linux, but an unlimited number of bits in the USB hid spec, so there is some rearchitecture needed now that devices are sending more than 32 bits. Signed-off-by: Joshua Clayton diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index 210b81a56e1a..3eaee2c37931 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c @@ -1311,8 +1311,8 @@ u32 hid_field_extract(const struct hid_device *hid, u8 *report, unsigned offset, unsigned n) { if (n > 32) { - hid_warn(hid, "hid_field_extract() called with n (%d) > 32! (%s)\n", - n, current->comm); + hid_warn_once(hid, "%s() called with n (%d) > 32! (%s)\n", + __func__, n, current->comm); n = 32; } -- 2.21.0