]> git.baikalelectronics.ru Git - kernel.git/commit
thermal/int340x_thermal: handle data_vault when the value is ZERO_SIZE_PTR
authorLee, Chun-Yi <joeyli.kernel@gmail.com>
Mon, 8 Aug 2022 13:21:58 +0000 (21:21 +0800)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Tue, 23 Aug 2022 17:50:43 +0000 (19:50 +0200)
commitfb995fe88fe6d517d15aa40f9729d613d06f837c
treea1ae24264c8b266db0f0af7c2fb33b2b1825243d
parentacaa855d21c1fc8e8a1fab873003c0736c2d01f6
thermal/int340x_thermal: handle data_vault when the value is ZERO_SIZE_PTR

In some case, the GDDV returns a package with a buffer which has
zero length. It causes that kmemdup() returns ZERO_SIZE_PTR (0x10).

Then the data_vault_read() got NULL point dereference problem when
accessing the 0x10 value in data_vault.

[   71.024560] BUG: kernel NULL pointer dereference, address:
0000000000000010

This patch uses ZERO_OR_NULL_PTR() for checking ZERO_SIZE_PTR or
NULL value in data_vault.

Signed-off-by: "Lee, Chun-Yi" <jlee@suse.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/thermal/intel/int340x_thermal/int3400_thermal.c