All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kernel-janitors@vger.kernel.org
Subject: [patch] hwmon: using wrong ARRAY_SIZE() limit
Date: Wed, 17 Jul 2013 12:26:14 +0000	[thread overview]
Message-ID: <20130717084317.GA4851@elgon.mountain> (raw)

We cleaned up this code to use ARRAY_SIZE() instead of just the number
4.  The problem is that data->reg_temp[] has 5 elements and we actually
wanted ARRAY_SIZE(data->temp) which has 4 elements.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/hwmon/nct6775.c b/drivers/hwmon/nct6775.c
index f0941d7..52b6a92 100644
--- a/drivers/hwmon/nct6775.c
+++ b/drivers/hwmon/nct6775.c
@@ -1451,7 +1451,7 @@ static struct nct6775_data *nct6775_update_device(struct device *dev)
 		for (i = 0; i < NUM_TEMP; i++) {
 			if (!(data->have_temp & (1 << i)))
 				continue;
-			for (j = 0; j < ARRAY_SIZE(data->reg_temp); j++) {
+			for (j = 0; j < ARRAY_SIZE(data->temp); j++) {
 				if (data->reg_temp[j][i])
 					data->temp[j][i]
 					  = nct6775_read_temp(data,
@@ -3974,7 +3974,7 @@ static int nct6775_resume(struct device *dev)
 		if (!(data->have_temp & (1 << i)))
 			continue;
 
-		for (j = 1; j < ARRAY_SIZE(data->reg_temp); j++)
+		for (j = 1; j < ARRAY_SIZE(data->temp); j++)
 			if (data->reg_temp[j][i])
 				nct6775_write_temp(data, data->reg_temp[j][i],
 						   data->temp[j][i]);

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kernel-janitors@vger.kernel.org
Subject: [lm-sensors] [patch] hwmon: using wrong ARRAY_SIZE() limit
Date: Wed, 17 Jul 2013 12:26:14 +0000	[thread overview]
Message-ID: <20130717084317.GA4851@elgon.mountain> (raw)

We cleaned up this code to use ARRAY_SIZE() instead of just the number
4.  The problem is that data->reg_temp[] has 5 elements and we actually
wanted ARRAY_SIZE(data->temp) which has 4 elements.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/hwmon/nct6775.c b/drivers/hwmon/nct6775.c
index f0941d7..52b6a92 100644
--- a/drivers/hwmon/nct6775.c
+++ b/drivers/hwmon/nct6775.c
@@ -1451,7 +1451,7 @@ static struct nct6775_data *nct6775_update_device(struct device *dev)
 		for (i = 0; i < NUM_TEMP; i++) {
 			if (!(data->have_temp & (1 << i)))
 				continue;
-			for (j = 0; j < ARRAY_SIZE(data->reg_temp); j++) {
+			for (j = 0; j < ARRAY_SIZE(data->temp); j++) {
 				if (data->reg_temp[j][i])
 					data->temp[j][i]
 					  = nct6775_read_temp(data,
@@ -3974,7 +3974,7 @@ static int nct6775_resume(struct device *dev)
 		if (!(data->have_temp & (1 << i)))
 			continue;
 
-		for (j = 1; j < ARRAY_SIZE(data->reg_temp); j++)
+		for (j = 1; j < ARRAY_SIZE(data->temp); j++)
 			if (data->reg_temp[j][i])
 				nct6775_write_temp(data, data->reg_temp[j][i],
 						   data->temp[j][i]);

_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

             reply	other threads:[~2013-07-17 12:26 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-17 12:26 Dan Carpenter [this message]
2013-07-17 12:26 ` [lm-sensors] [patch] hwmon: using wrong ARRAY_SIZE() limit Dan Carpenter
2013-07-17 23:36 ` Guenter Roeck
2013-07-17 23:36   ` [lm-sensors] " Guenter Roeck
2013-07-18 15:41 ` walter harms
2013-07-18 15:41   ` [lm-sensors] " walter harms
2013-07-18 20:43 ` Guenter Roeck
2013-07-18 20:43   ` [lm-sensors] " Guenter Roeck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130717084317.GA4851@elgon.mountain \
    --to=dan.carpenter@oracle.com \
    --cc=kernel-janitors@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.