Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp7585519ybi; Mon, 22 Jul 2019 16:15:11 -0700 (PDT) X-Google-Smtp-Source: APXvYqyFrTpLVPsOlKtRETIYnfOc90xzVMprVP4Hh+2yOrBnBRxAKy5f2GphKS1Yp1NDAL7xK1rV X-Received: by 2002:a17:902:b20c:: with SMTP id t12mr78242017plr.285.1563837311032; Mon, 22 Jul 2019 16:15:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563837311; cv=none; d=google.com; s=arc-20160816; b=ulgG0hbjoTUg2W4j6nofHgy381ckEmsHOfmRxa4YN64M3EmgJrd0ERYcyDUTkvXCOO 2J4Xxw2vcCsSr1qXu9m7/rs22528Hjf+tiH7P02ey6qprXDiiVTQ3GbXJ8GYHBN0W8Vy aya3Gpj4co1N7e12uUoHfpVZxNX7gnD/hLSz7dTLiTX5AZermTLnKxdELPtzeVyfdYWY WF4qK5BirIQFOM7S7mn/2O7PUiOK64jQVMBBWjyDvw7DHsXghEBNKC8FeJ8LArmk/jXa IbKTKY7etyv8ucQPfXjzDyJkR8nyv+Zv4kQrosWacTBZGU1IAFclhN4oqKa/RLWlzxdM bsnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=DiLnzYLxVxNlR4X0FDTGEx7Tdx3UEKGH5o6qiAjVh8Q=; b=CNV6+xrlsEu1YI5cMzE5mO5Nd1hzjFPJareipkxmDutOFaN0DjPKvO3Sz8fumkihdg 5FYRluVhWiNUkO1xCx1iVDSc1VkMsQ804AOPEgLes8UH6d58/cquKkfjXQWKJXrQHyc0 Fynu0rwtEktlWjrncYvAvJIZUA2WEG7Rk/auHpiNYODqXGLQHHDEEP2ai1TZf/H44jMi c1GIuiknb0ZJGr75arp09HrfKmLAblMOnq6wQ/n8Lk8jCZAJ+DiV4MjwOnVnkidITS5l INkMneMqm508m/dOyHzftPanhoN2+l3GzETQk0dJR9Qo6gOJ/LlP7C15IEGqW5I3rhnM KqpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="W/t9Zea5"; 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 k8si11547399pgt.548.2019.07.22.16.14.55; Mon, 22 Jul 2019 16:15:11 -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="W/t9Zea5"; 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 S1731247AbfGVSQj (ORCPT + 99 others); Mon, 22 Jul 2019 14:16:39 -0400 Received: from mail-io1-f67.google.com ([209.85.166.67]:43305 "EHLO mail-io1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726070AbfGVSQi (ORCPT ); Mon, 22 Jul 2019 14:16:38 -0400 Received: by mail-io1-f67.google.com with SMTP id k20so76002509ios.10; Mon, 22 Jul 2019 11:16:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=DiLnzYLxVxNlR4X0FDTGEx7Tdx3UEKGH5o6qiAjVh8Q=; b=W/t9Zea5qieGnHP8RQZ4lfk7JCGOJps+WDcC5zHsisq4ZFIF2vbM0gAY/CHLo2sseh 2znLyJrbRfG7pgmboAEYGZ5JtpKB2z4bytV8muaUKaej93YqbQ2ZudHLPPRvls4lJ9s3 re/+p8WeVXyzfJyRcIA8wdGIzFbcXsr0Z6IQcEA1rZiSoOS5nKFfnIc7zuZzJlPb04jW gKdHjXD+RXRcJ78xbDi7K0RFUMVUS8wXy2g1J8y/zSpI4D/A4vL/sIyUvp2+4c/iJLoL dZtTsYZFjYztVy4Pc2hEtW/2Aa2Bupk8IzJPgnCwHaUiHESK5v8rOEgtdQ6WrUjwlUwR fx4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=DiLnzYLxVxNlR4X0FDTGEx7Tdx3UEKGH5o6qiAjVh8Q=; b=qM8LR7qeo36x3AyjkxTHM7Xl4ixQl8QCpt+m0CDAo7XOq98qB1gpHtRY9tTRYa0/P4 sL6mDIN+zNE5tZOXb2+aEvRIUWzgzZlbFnhqy2sEhrPLSKB7rRPJNrjpPEJfFW03G/mw ZvlgGTIi6KRnaIFaOYduXSVDyrhITos+4k+DDDC82jJNINpQmRuFii+nJ+LN3aHDVP7W kpHrqM17WoYGom2cBZIin1S4TNxqghy5EqFdOFGwUnf7ggE6Yi+l5wB/JoGvoX+/qSPy 6fIkD73ZEA41Mbj+mCqvNwAE9hXUQvk8YHiW32cvWpmx/qDYWyiFJalCq+yEll/o/d18 mYCg== X-Gm-Message-State: APjAAAXMJJEY07RrOGUbvEWTQoJtM8XeFzDeZuuYwOrYBgMnHGJ918YQ fuX4bV4WBD3P+S+z2McwyzZEXcho99X1n6p2FhA= X-Received: by 2002:a05:6638:517:: with SMTP id i23mr109879jar.71.1563819397741; Mon, 22 Jul 2019 11:16:37 -0700 (PDT) MIME-Version: 1.0 References: <20190722163642.10417-1-stillcompiling@gmail.com> <20190722163642.10417-2-stillcompiling@gmail.com> In-Reply-To: From: Joshua Clayton Date: Mon, 22 Jul 2019 12:16:26 -0600 Message-ID: Subject: Re: [PATCH 2/2] HID: core: only warn once of oversize hid report To: Joe Perches Cc: Jiri Kosina , Benjamin Tissoires , "open list:HID CORE LAYER" , open list Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jul 22, 2019 at 11:23 AM Joe Perches wrote: > > On Mon, 2019-07-22 at 10:36 -0600, stillcompiling@gmail.com wrote: > > 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 other kernel logs > > Protect dmesg by printing the warning only one time. > [] > > diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c > [] > > @@ -1311,7 +1311,7 @@ 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", > > + hid_warn_once(hid, "hid_field_extract() called with n (%d) > 32! (%s)\n", > > n, current->comm); > > n = 32; > > } > > Is this papering over an actual defect somewhere else? Sort of. It doesn't correct the underlying issue, but I think this should go in even along with the real fix. The dmesg spamming has become a more serious problem for me than the underlying issue. Someone had a patch rejected that completely suppressed the message. From my limited understanding, the hid spec allows an unlimited size for an hid report , but the kernel only allocated 32 bits, which was more than anything used at that time. The 32 bit version is doing some bit shifting and possibly endian correction with the 32 bit field, so I was not comfortable just extending it to 192 or 256 bits without a little more understanding. > Trivially, this could use "%s: ...", __func__, ... True. I can make that change. >