mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-22 17:36:20 +03:00
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>
This commit is contained in:
committed by
mobile promotions
parent
de6b40b862
commit
1982d050cc
@@ -102,10 +102,10 @@ static struct unit_module *load_one_module(struct unit_fw *fw,
|
||||
|
||||
static int cmp_module_prio(const void *__mod_a, const void *__mod_b)
|
||||
{
|
||||
const struct unit_module *mod_a = __mod_a;
|
||||
const struct unit_module *mod_b = __mod_b;
|
||||
const struct unit_module * const *mod_a = __mod_a;
|
||||
const struct unit_module * const *mod_b = __mod_b;
|
||||
|
||||
return mod_a->prio > mod_b->prio;
|
||||
return (*mod_a)->prio > (*mod_b)->prio;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user