Checklist
Description
Analyzer message:
V568 Its odd that the argument of sizeof() operator is the sizeof (int) * 512expression. aio.cpp 318 V1086 A call of thememsetfunction will lead to underflow of the bufferid_state`. aio.cpp 318
A highly probable error or very strange code that requires a comment\simplification.
namespace Libraries::Kernel {
#define MAX_QUEUE 512
static s32* id_state;
static s32 id_index;
....
}
void RegisterAio(Core::Loader::SymbolsResolver* sym) {
id_index = 1;
id_state = (int*)malloc(sizeof(int) * MAX_QUEUE);
memset(id_state, 0, sizeof(sizeof(int) * MAX_QUEUE));
....
}
sizeof(int) * 512 have type size_t, then sizeof(sizeof(int) * MAX_QUEUE)) == 4 or 8 bytes.
Link to an article with additional information: https://pvs-studio.com/en/blog/posts/cpp/1405/
Reason
Fixing potential bug and\or code quality.
Examples
No response
Checklist
Description
Analyzer message:
V568 It
s odd that the argument of sizeof() operator is thesizeof (int) * 512expression. aio.cpp 318 V1086 A call of thememsetfunction will lead to underflow of the bufferid_state`. aio.cpp 318A highly probable error or very strange code that requires a comment\simplification.
sizeof(int) * 512have typesize_t, thensizeof(sizeof(int) * MAX_QUEUE))== 4 or 8 bytes.Link to an article with additional information: https://pvs-studio.com/en/blog/posts/cpp/1405/
Reason
Fixing potential bug and\or code quality.
Examples
No response