From 34960d4d6e9c0cc22cd12f5a6d8dcbb5ebf975f0 Mon Sep 17 00:00:00 2001 From: Guenter Roeck Date: Thu, 26 Apr 2012 05:10:33 -0700 Subject: [PATCH] Check for invalid temperature source Signed-off-by: Guenter Roeck --- nct6775.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/nct6775.c b/nct6775.c index 9a5d955..6e21ffb 100644 --- a/nct6775.c +++ b/nct6775.c @@ -3330,6 +3330,12 @@ static int __devinit nct6775_probe(struct platform_device *pdev) if (!src || (mask & (1 << src))) continue; + if (src >= data->temp_label_num || + !strlen(data->temp_label[src])) { + dev_info(dev, "Invalid temperature source %d\n", src); + continue; + } + mask |= 1 << src; /* Use fixed index for SYSTIN(1), CPUTIN(2), AUXTIN(3) */ -- 2.39.5