Stanse found that there are two NULL checks missing in ips_monitor. So
check their value too and bail out appropriately if the allocation
failed.

Signed-off-by: Jiri Slaby <[email protected]>
Cc: Jesse Barnes <[email protected]>
Cc: Matthew Garrett <[email protected]>
---
 drivers/platform/x86/intel_ips.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/platform/x86/intel_ips.c b/drivers/platform/x86/intel_ips.c
index cdaf40e..3c7ea9a 100644
--- a/drivers/platform/x86/intel_ips.c
+++ b/drivers/platform/x86/intel_ips.c
@@ -931,7 +931,8 @@ static int ips_monitor(void *data)
        mch_samples = kzalloc(sizeof(u16) * IPS_SAMPLE_COUNT, GFP_KERNEL);
        cpu_samples = kzalloc(sizeof(u32) * IPS_SAMPLE_COUNT, GFP_KERNEL);
        mchp_samples = kzalloc(sizeof(u32) * IPS_SAMPLE_COUNT, GFP_KERNEL);
-       if (!mcp_samples || !ctv1_samples || !ctv2_samples || !mch_samples) {
+       if (!mcp_samples || !ctv1_samples || !ctv2_samples || !mch_samples ||
+                       !cpu_samples || !mchp_samples) {
                dev_err(&ips->dev->dev,
                        "failed to allocate sample array, ips disabled\n");
                kfree(mcp_samples);
-- 
1.7.1


--
To unsubscribe from this list: send the line "unsubscribe platform-driver-x86" 
in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to