summaryrefslogtreecommitdiff
path: root/tools/intel_gpu_frequency.c
diff options
context:
space:
mode:
authorThomas Wood <thomas.wood@intel.com>2015-01-13 11:50:02 +0000
committerThomas Wood <thomas.wood@intel.com>2015-01-15 11:30:39 +0000
commitc1d8293cc79350aa0ee803c7408a9c970f8eebc8 (patch)
tree7077c476d69f2c4d15d92fcb27a8bae9bb432a08 /tools/intel_gpu_frequency.c
parenta263cc87958de96acd77fdae6bf8a09bdf46204e (diff)
intel_gpu_frequency: fix array bounds warning
Add a parameter for the size of the act_upon array in the parse function since its size cannot be calculated with ARRAY_SIZE from just the pointer. Cc: Ben Widawsky <benjamin.widawsky@intel.com> Signed-off-by: Thomas Wood <thomas.wood@intel.com>
Diffstat (limited to 'tools/intel_gpu_frequency.c')
-rw-r--r--tools/intel_gpu_frequency.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/tools/intel_gpu_frequency.c b/tools/intel_gpu_frequency.c
index d9e7d228..aedceb45 100644
--- a/tools/intel_gpu_frequency.c
+++ b/tools/intel_gpu_frequency.c
@@ -179,7 +179,7 @@ version(const char *prog)
/* Returns read or write operation */
static bool
-parse(int argc, char *argv[], bool *act_upon, int *new_freq)
+parse(int argc, char *argv[], bool *act_upon, size_t act_upon_n, int *new_freq)
{
int c, tmp;
bool write = false;
@@ -193,7 +193,7 @@ parse(int argc, char *argv[], bool *act_upon, int *new_freq)
/* No args means -g" */
if (argc == 1) {
- for (c = 0; c < ARRAY_SIZE(act_upon); c++)
+ for (c = 0; c < act_upon_n; c++)
act_upon[c] = true;
goto done;
}
@@ -233,7 +233,7 @@ parse(int argc, char *argv[], bool *act_upon, int *new_freq)
}
} else {
int i;
- for (i = 0; i < ARRAY_SIZE(act_upon); i++)
+ for (i = 0; i < act_upon_n; i++)
act_upon[i] = true;
}
break;
@@ -333,7 +333,7 @@ int main(int argc, char *argv[])
devid = intel_get_drm_devid(drm_open_any());
device = drm_get_card();
- write = parse(argc, argv, targets, set_freq);
+ write = parse(argc, argv, targets, ARRAY_SIZE(targets), set_freq);
fail = write;
/* If we've previously locked the frequency, we need to make sure to set things