[SRU] [B/D/E/OEM-OSP1-B] [PATCH 0/3] Suppress "hid_field_extract() called with n (192) > 32!" message floods

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

[SRU] [B/D/E/OEM-OSP1-B] [PATCH 0/3] Suppress "hid_field_extract() called with n (192) > 32!" message floods

Kai-Heng Feng
BugLink: https://bugs.launchpad.net/bugs/1850600

Joshua Clayton (3):
  HID: core: reformat and reduce hid_printk macros
  HID: core: Add printk_once variants to hid_warn() etc
  HID: core: fix dmesg flooding if report field larger than 32bit

 drivers/hid/hid-core.c |  4 ++--
 include/linux/hid.h    | 43 ++++++++++++++++++++++--------------------
 2 files changed, 25 insertions(+), 22 deletions(-)

--
2.17.1


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

[B/D/E/OEM-OSP1-B] [PATCH 1/3] HID: core: reformat and reduce hid_printk macros

Kai-Heng Feng
From: Joshua Clayton <[hidden email]>

BugLink: https://bugs.launchpad.net/bugs/1850600

Reformat hid_printk macros to use standard __VA_ARGS__ syntax.
Per Joe Perches hid_printk(), hid_emerg(), hid_crit(), and hid_alert() are
unlikely ever to be used. Remove them.

Signed-off-by: Joshua Clayton <[hidden email]>
Signed-off-by: Benjamin Tissoires <[hidden email]>
(cherry picked from commit 337c22ab1d4f316f37e7a7c78bdea3d768270542)
Signed-off-by: Kai-Heng Feng <[hidden email]>
---
 include/linux/hid.h | 32 ++++++++++++--------------------
 1 file changed, 12 insertions(+), 20 deletions(-)

diff --git a/include/linux/hid.h b/include/linux/hid.h
index 5a24ebfb5b47..3881ce5cf1e8 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -1165,29 +1165,21 @@ int hid_pidff_init(struct hid_device *hid);
 #define hid_pidff_init NULL
 #endif
 
-#define dbg_hid(format, arg...) \
+#define dbg_hid(fmt, ...) \
 do { \
  if (hid_debug) \
- printk(KERN_DEBUG "%s: " format, __FILE__, ##arg); \
+ printk(KERN_DEBUG "%s: " fmt, __FILE__, ##__VA_ARGS__); \
 } while (0)
 
-#define hid_printk(level, hid, fmt, arg...) \
- dev_printk(level, &(hid)->dev, fmt, ##arg)
-#define hid_emerg(hid, fmt, arg...) \
- dev_emerg(&(hid)->dev, fmt, ##arg)
-#define hid_crit(hid, fmt, arg...) \
- dev_crit(&(hid)->dev, fmt, ##arg)
-#define hid_alert(hid, fmt, arg...) \
- dev_alert(&(hid)->dev, fmt, ##arg)
-#define hid_err(hid, fmt, arg...) \
- dev_err(&(hid)->dev, fmt, ##arg)
-#define hid_notice(hid, fmt, arg...) \
- dev_notice(&(hid)->dev, fmt, ##arg)
-#define hid_warn(hid, fmt, arg...) \
- dev_warn(&(hid)->dev, fmt, ##arg)
-#define hid_info(hid, fmt, arg...) \
- dev_info(&(hid)->dev, fmt, ##arg)
-#define hid_dbg(hid, fmt, arg...) \
- dev_dbg(&(hid)->dev, fmt, ##arg)
+#define hid_err(hid, fmt, ...) \
+ dev_err(&(hid)->dev, fmt, ##__VA_ARGS__)
+#define hid_notice(hid, fmt, ...) \
+ dev_notice(&(hid)->dev, fmt, ##__VA_ARGS__)
+#define hid_warn(hid, fmt, ...) \
+ dev_warn(&(hid)->dev, fmt, ##__VA_ARGS__)
+#define hid_info(hid, fmt, ...) \
+ dev_info(&(hid)->dev, fmt, ##__VA_ARGS__)
+#define hid_dbg(hid, fmt, ...) \
+ dev_dbg(&(hid)->dev, fmt, ##__VA_ARGS__)
 
 #endif
--
2.17.1


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

[B/D/E/OEM-OSP1-B] [PATCH 2/3] HID: core: Add printk_once variants to hid_warn() etc

Kai-Heng Feng
In reply to this post by Kai-Heng Feng
From: Joshua Clayton <[hidden email]>

BugLink: https://bugs.launchpad.net/bugs/1850600

hid_warn_once() is needed. Add the others as part of the block.

Signed-off-by: Joshua Clayton <[hidden email]>
Signed-off-by: Benjamin Tissoires <[hidden email]>
(cherry picked from commit aaeabb121a6271775cef35ec3197e9ef124fdb2a)
Signed-off-by: Kai-Heng Feng <[hidden email]>
---
 include/linux/hid.h | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/include/linux/hid.h b/include/linux/hid.h
index 3881ce5cf1e8..c003564778a3 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -1182,4 +1182,15 @@ do { \
 #define hid_dbg(hid, fmt, ...) \
  dev_dbg(&(hid)->dev, fmt, ##__VA_ARGS__)
 
+#define hid_err_once(hid, fmt, ...) \
+ dev_err_once(&(hid)->dev, fmt, ##__VA_ARGS__)
+#define hid_notice_once(hid, fmt, ...) \
+ dev_notice_once(&(hid)->dev, fmt, ##__VA_ARGS__)
+#define hid_warn_once(hid, fmt, ...) \
+ dev_warn_once(&(hid)->dev, fmt, ##__VA_ARGS__)
+#define hid_info_once(hid, fmt, ...) \
+ dev_info_once(&(hid)->dev, fmt, ##__VA_ARGS__)
+#define hid_dbg_once(hid, fmt, ...) \
+ dev_dbg_once(&(hid)->dev, fmt, ##__VA_ARGS__)
+
 #endif
--
2.17.1


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

[B/D/E/OEM-OSP1-B] [PATCH 3/3] HID: core: fix dmesg flooding if report field larger than 32bit

Kai-Heng Feng
In reply to this post by Kai-Heng Feng
From: Joshua Clayton <[hidden email]>

BugLink: https://bugs.launchpad.net/bugs/1850600

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 <[hidden email]>
Signed-off-by: Benjamin Tissoires <[hidden email]>
(cherry picked from commit 0af10eed9b7308187c7865024248b2a2a5aa382a)
Signed-off-by: Kai-Heng Feng <[hidden email]>
---
 drivers/hid/hid-core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 39eba8106d40..81df03e1bb24 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -1314,8 +1314,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.17.1


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

ACK/APPLIED[OEM-B]: [SRU] [B/D/E/OEM-OSP1-B] [PATCH 0/3] Suppress "hid_field_extract() called with n (192) > 32!" message floods

AceLan Kao
In reply to this post by Kai-Heng Feng
Acked-By: AceLan Kao <[hidden email]>

--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

ACK: [SRU] [B/D/E/OEM-OSP1-B] [PATCH 0/3] Suppress "hid_field_extract() called with n (192) > 32!" message floods

Connor Kuehl
In reply to this post by Kai-Heng Feng
On 10/30/19 12:16 AM, Kai-Heng Feng wrote:

> BugLink: https://bugs.launchpad.net/bugs/1850600
>
> Joshua Clayton (3):
>    HID: core: reformat and reduce hid_printk macros
>    HID: core: Add printk_once variants to hid_warn() etc
>    HID: core: fix dmesg flooding if report field larger than 32bit
>
>   drivers/hid/hid-core.c |  4 ++--
>   include/linux/hid.h    | 43 ++++++++++++++++++++++--------------------
>   2 files changed, 25 insertions(+), 22 deletions(-)
>

Acked-by: Connor Kuehl <[hidden email]>

--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

APPLIED(B,D,E): [SRU] [B/D/E/OEM-OSP1-B] [PATCH 0/3] Suppress "hid_field_extract() called with n (192) > 32!" message floods

Khaled Elmously
In reply to this post by Kai-Heng Feng
On 2019-10-30 15:16:49 , Kai-Heng Feng wrote:

> BugLink: https://bugs.launchpad.net/bugs/1850600
>
> Joshua Clayton (3):
>   HID: core: reformat and reduce hid_printk macros
>   HID: core: Add printk_once variants to hid_warn() etc
>   HID: core: fix dmesg flooding if report field larger than 32bit
>
>  drivers/hid/hid-core.c |  4 ++--
>  include/linux/hid.h    | 43 ++++++++++++++++++++++--------------------
>  2 files changed, 25 insertions(+), 22 deletions(-)
>
> --
> 2.17.1
>
>
> --
> kernel-team mailing list
> [hidden email]
> https://lists.ubuntu.com/mailman/listinfo/kernel-team

--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team