mca_base_var.c: add debug check for another programming error
Coverity alerted us to the fact that there are places where the synonym_for param is hard-coded to -1 when calling register_variable(). It would be a coding error if synonym_for==-1 and (flags & MCA_BASE_VAR_FLAG_SYNONYM)>0, so let's add that to the debug-only check at the top of the function. This was CID 993717.
Этот коммит содержится в:
родитель
167d72ec68
Коммит
00c878957c
@ -10,7 +10,7 @@
|
||||
* University of Stuttgart. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2008-2014 Cisco Systems, Inc. All rights reserved.
|
||||
* Copyright (c) 2008-2015 Cisco Systems, Inc. All rights reserved.
|
||||
* Copyright (c) 2012-2014 Los Alamos National Security, LLC. All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2014 Intel, Inc. All rights reserved.
|
||||
@ -1244,6 +1244,12 @@ static int register_variable (const char *project_name, const char *framework_na
|
||||
if (0 != align) {
|
||||
assert(((uintptr_t) storage) % align == 0);
|
||||
}
|
||||
|
||||
/* Also check to ensure that synonym_for>=0 when
|
||||
MCA_BCASE_VAR_FLAG_SYNONYM is specified */
|
||||
if (flags & MCA_BASE_VAR_FLAG_SYNONYM && synonym_for < 0) {
|
||||
assert((flags & MCA_BASE_VAR_FLAG_SYNONYM) && synonym_for >= 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* There are data holes in the var struct */
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user