Вы находитесь на странице: 1из 7

Intel Energy Checker

SDK (IEC SDK) PVS-Studio


:
: 28.07.2011
, , ,
.
, Apache, MySQL, Chromium. ,
. ,
. ,
.
. Intel(R) Energy Checker SDK (IEC SDK).

Intel Energy Checker SDK - , 74500 .


, WinMerge 186 000 , Miranda IM
950 000 .

, , ,
'goto'. ? , .

, , , .
, .
. ,
, , , .
, , . . 247
. ? , . .
2000 :
V553 The length of 'pl_open' function's body is more than 2000 lines long. You should consider
refactoring the code. pl_csv_logger productivity_link.c 379
V553 The length of 'pl_attach' function's body is more than 2000 lines long. You should consider
refactoring the code. pl_csv_logger productivity_link.c 9434
V553 The length of 'main' function's body is more than 2000 lines long. You should consider refactoring
the code. cluster_energy_efficiency cee.c 97
V553 The length of 'main' function's body is more than 2000 lines long. You should consider refactoring
the code. pl2ganglia pl2ganglia.c 105

:
#define PL_FOLDER_STRING "C:\\productivity_link"
#define PL_PATH_SEPARATOR_STRING "\\"
#define PL_APPLICATION_NAME_SEPARATOR_STRING "_"
...
pl_root_name_length = strlen(PL_FOLDER_STRING);
pl_root_name_length += strlen(PL_PATH_SEPARATOR_STRING);
pl_root_name_length += application_name_length;
pl_root_name_length += strlen(PL_APPLICATION_NAME_SEPARATOR_STRING);
pl_root_name_length += PL_UUID_MAX_CHARS;
pl_root_name_length += strlen(PL_PATH_SEPARATOR_STRING);
,
. , "#define
STRLEN(s) (sizeof(s) / sizeof(*s) - 1)". ,
, "C:\\". :
#define PL_INI_WINDOWS_FOLDER "C:\\productivity_link"
#define PL_INI_WINDOWS_LC_FOLDER "c:\\productivity_link"
#define PLH_FOLDER_SEARCH _T("C:\\productivity_link\\*")

, ,
. , PVS-Studio
. , 74000
. LINUX/SOLARIS/MACOSX
#ifdef/#endif , . #ifdef/#endif
, .
.
IEC SDK , ,
. , .

, :
V557 Array overrun is possible. The '255' index is pointing beyond array bound. pl2ganglia pl2ganglia.c
1114

#define PL_MAX_PATH 255


#define PL2GANFLIA_COUNTER_MAX_LENGTH PL_MAX_PATH

char name[PL_MAX_PATH];

int main(int argc, char *argv[]) {


...
p->pl_counters_data[i].name[
PL2GANFLIA_COUNTER_MAX_LENGTH
] = '\0';
...
}
.
:
p->pl_counters_data[i].name[
PL2GANFLIA_COUNTER_MAX_LENGTH - 1
] = '\0';

.
V568 It's odd that the argument of sizeof() operator is the '& file_data' expression. pl_csv_logger
productivity_link_helper.c 1667
V568 It's odd that the argument of sizeof() operator is the '& file_data' expression. pl_csv_logger
productivity_link_helper.c 1831
V512 A call of the 'memset' function will lead to underflow of the buffer 'pconfig'. pl_csv_logger
productivity_link_helper.c 1806

:
int plh_read_pl_folder(PPLH_PL_FOLDER_INFO pconfig) {
...
WIN32_FIND_DATA file_data;
...
memset(
&file_data,
0,
sizeof(&file_data)
);
...
}
, WIN32_FIND_DATA
. , , Windows
. , "Use Unicode Character
Set", . , .
Visual Studio, "Character Set" UNICODE.
, c , .
:
V512 A call of the 'memset' function will lead to underflow of the buffer '(pl_cvt_buffer)'. pl_csv_logger
productivity_link_helper.c 683

#define PL_MAX_PATH 255


typedef WCHAR TCHAR, *PTCHAR;
TCHAR pl_cvt_buffer[PL_MAX_PATH] = { '\0' };

int plh_read_pl_config_ini_file(...)
{
...
ZeroMemory(
pl_cvt_buffer,
PL_MAX_PATH
);
...
}

, , UNICODE .
- :
V576 Incorrect format. Consider checking the second actual argument of the 'wprintf' function. The
pointer to string of wchar_t type symbols is expected. producer producer.c 166
int main(void) {
...
char *p = NULL;
...
#ifdef __PL_WINDOWS__
wprintf(
_T("Using power link directory: %s\n"),
p
);
#endif // __PL_WINDOWS__
...
}
. wprintf "wchar_t *", "char *".

, , :

V571 Recurring check. The 'if (ret == PL_FAILURE)' condition was already verified in line 1008.
pl_csv_logger pl_csv_logger.c 1009
if(ret == PL_FAILURE) {
if(ret == PL_FAILURE) {
pl_csv_logger_error(
PL_CSV_LOGGER_ERROR_UNABLE_TO_READ_PL
);
. - ,
. SDK
.


, , , 'goto'. ,
. 1198 goto.
goto 60 . , .

?
PVS-Studio. :-)

, IEC SDK
PVS-Studio,
-, ,
.
.
Errare humanum est ( )
, !
"Energy Checker", ,
, .

Microsoft Visual Studio 2005. ,
, " ",
. , ,
. ,
, , PVS-Studio
.
. PVS-Studio " " .
, . , , ,
(

). ,
.
, .
,
.
, , , "copy-paste" . ,
, , ,
. , .
PVS-Studio .
, ,
PVS-Studio.
, IEC SDK