intel_gpu_frequency: fix array bounds warning
PATCH 1/2 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 <[email protected]>
Signed-off-by Thomas Wood <[email protected]>
--- tools/intel_gpu_frequency.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
tools/intel_gpu_frequency.c +4 -4
@@ -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
Signature · 6 lines
2.1.0 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 2/2 tools: add intel_gpu_frequency to .gitignore
intel_gpu_frequency was added in commit 5fb26d1 (intel_gpu_frequency: A tool to manipulate Intel GPU frequency), but wasn't added to .gitignore.
Cc Ben Widawsky <[email protected]>
Signed-off-by Thomas Wood <[email protected]>
--- tools/.gitignore | 1 + 1 file changed, 1 insertion(+)
tools/.gitignore +1 -0
@@ -13,6 +13,7 @@ intel_error_decode intel_forcewaked intel_framebuffer_dump intel_gpu_dump +intel_gpu_frequency intel_gpu_time intel_gpu_top intel_gtt
Signature · 6 lines
2.1.0 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx