Skip to content

Commit b36e13d

Browse files
Romain PEREIRAperarnau
authored andcommitted
Moved-up parameters check, that would cause segv before reaching otherwise
1 parent 06d1965 commit b36e13d

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

src/area/hwloc.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,12 @@ int aml_area_hwloc_preferred_create(struct aml_area **area,
323323
hwloc_obj_t initiator,
324324
enum hwloc_distances_kind_e kind)
325325
{
326+
// Check input
327+
if (area == NULL)
328+
return -AML_EINVAL;
329+
if (initiator == NULL)
330+
return -AML_EINVAL;
331+
326332
// The number of nodes in this system.
327333
const unsigned num_nodes =
328334
hwloc_get_nbobjs_by_type(aml_topology, HWLOC_OBJ_NUMANODE);
@@ -340,12 +346,6 @@ int aml_area_hwloc_preferred_create(struct aml_area **area,
340346
// distances from/to initiator, to/from target.
341347
hwloc_uint64_t itot = 0, ttoi = 0;
342348

343-
// Check input
344-
if (area == NULL)
345-
return -AML_EINVAL;
346-
if (initiator == NULL)
347-
return -AML_EINVAL;
348-
349349
// Allocate structures
350350
aml_area_hwloc_preferred_alloc(&ar);
351351
if (ar == NULL)

0 commit comments

Comments
 (0)