mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-22 17:36:20 +03:00
gpu: nvgpu: unit: only load .so files
There was a situation where a .so.debug file was stored with the unit .so files and was causing the unit test framework to abort with a "Bus Error." This update only loads files ending in .so to avoid loading invalid files in the future. Bug 2415403 Change-Id: I0c3cdd7a05942b746695f88f5b1f2324f309daba Signed-off-by: Philip Elcan <pelcan@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1924614 Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com> GVS: Gerrit_Virtual_Submit Reviewed-by: Nicolas Benech <nbenech@nvidia.com> Reviewed-by: Konsta Holtta <kholtta@nvidia.com> Reviewed-by: Alex Waterman <alexw@nvidia.com> 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
2a465533ab
commit
7ac7c061a1
@@ -117,6 +117,17 @@ static void sort_modules_by_prio(struct unit_module **modules, int nr)
|
|||||||
cmp_module_prio);
|
cmp_module_prio);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool is_shared_obj_filename(char *name)
|
||||||
|
{
|
||||||
|
size_t len = strlen(name);
|
||||||
|
|
||||||
|
if ((len > 3) && (strcmp(&name[len-3], ".so") == 0)) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Load all the modules we can from the module load path. Return the list of
|
* Load all the modules we can from the module load path. Return the list of
|
||||||
* loaded module as an array of pointers to modules. The returned list of
|
* loaded module as an array of pointers to modules. The returned list of
|
||||||
@@ -142,11 +153,17 @@ struct unit_module **core_load_modules(struct unit_fw *fw)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (readdir(load_dir) != NULL)
|
ent = readdir(load_dir);
|
||||||
|
while (ent != NULL) {
|
||||||
|
if (is_shared_obj_filename(ent->d_name)) {
|
||||||
nr_modules += 1;
|
nr_modules += 1;
|
||||||
|
} else {
|
||||||
/* '.' and '..' should be skipped. */
|
core_vbs(fw, 1,
|
||||||
nr_modules -= 2;
|
"Skipping load of file %s (not a .so)\n",
|
||||||
|
ent->d_name);
|
||||||
|
}
|
||||||
|
ent = readdir(load_dir);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Now allocate necessary space for storing pointers to the modules and
|
* Now allocate necessary space for storing pointers to the modules and
|
||||||
@@ -162,7 +179,8 @@ struct unit_module **core_load_modules(struct unit_fw *fw)
|
|||||||
i = 0;
|
i = 0;
|
||||||
while ((ent = readdir(load_dir)) != NULL) {
|
while ((ent = readdir(load_dir)) != NULL) {
|
||||||
if (strcmp(".", ent->d_name) == 0 ||
|
if (strcmp(".", ent->d_name) == 0 ||
|
||||||
strcmp("..", ent->d_name) == 0)
|
strcmp("..", ent->d_name) == 0 ||
|
||||||
|
!is_shared_obj_filename(ent->d_name))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
mod = load_one_module(fw, ent);
|
mod = load_one_module(fw, ent);
|
||||||
|
|||||||
Reference in New Issue
Block a user