Make AqlPacket::string more robust
AqlPacket::string should check the packet type is in range of the array used to print its name. Change-Id: I33dabbd941d086929526d842c9dbc0bd7305acd5
This commit is contained in:
@@ -99,6 +99,11 @@ struct AqlPacket {
|
||||
"HSA_PACKET_TYPE_KERNEL_DISPATCH", "HSA_PACKET_TYPE_BARRIER_AND",
|
||||
"HSA_PACKET_TYPE_AGENT_DISPATCH", "HSA_PACKET_TYPE_BARRIER_OR"};
|
||||
|
||||
if (t >= sizeof(type_names) / sizeof(const char*)) {
|
||||
string << "type: UNKNOWN#" << t;
|
||||
return string.str();
|
||||
}
|
||||
|
||||
string << "type: " << type_names[t]
|
||||
<< "\nbarrier: " << ((dispatch.header >> HSA_PACKET_HEADER_BARRIER) &
|
||||
((1 << HSA_PACKET_HEADER_WIDTH_BARRIER) - 1))
|
||||
|
||||
Reference in New Issue
Block a user