summaryrefslogtreecommitdiffstats
path: root/userspace
diff options
context:
space:
mode:
authorKonsta Holtta <kholtta@nvidia.com>2018-09-17 09:52:01 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2018-09-18 02:42:05 -0400
commit1982d050cc8c90ef269476bec87778e8c3ade5f7 (patch)
treee775c5acf45428890bd3fcf582f96c7e66fcdc9b /userspace
parentde6b40b862d0a0c43d1b93d28c8a705040ebd4a3 (diff)
gpu: nvgpu: unit: deref twice in qsort callback
The compare function for qsort takes pointers to compared elements, and our elements are already pointers so the void pointer has to be cast to a pointer pointer. Dereferencing only once would compare some data that's in the array of module pointers (or past it), not the actual data where the module pointers point to. Change-Id: I65678863eddd6fc86d4ffceb621f8123944b058d Signed-off-by: Konsta Holtta <kholtta@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1828164 Reviewed-by: svc-misra-checker <svc-misra-checker@nvidia.com> GVS: Gerrit_Virtual_Submit Reviewed-by: Alex Waterman <alexw@nvidia.com> Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'userspace')
-rw-r--r--userspace/src/module.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/userspace/src/module.c b/userspace/src/module.c
index e8e08a18..3f1cb782 100644
--- a/userspace/src/module.c
+++ b/userspace/src/module.c
@@ -102,10 +102,10 @@ static struct unit_module *load_one_module(struct unit_fw *fw,
102 102
103static int cmp_module_prio(const void *__mod_a, const void *__mod_b) 103static int cmp_module_prio(const void *__mod_a, const void *__mod_b)
104{ 104{
105 const struct unit_module *mod_a = __mod_a; 105 const struct unit_module * const *mod_a = __mod_a;
106 const struct unit_module *mod_b = __mod_b; 106 const struct unit_module * const *mod_b = __mod_b;
107 107
108 return mod_a->prio > mod_b->prio; 108 return (*mod_a)->prio > (*mod_b)->prio;
109} 109}
110 110
111/* 111/*