mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-12-25 17:27:18 +00:00
bct_dump: don't crash on devices without RSA support
format_rsa_param() currently crashes on chips that don't implement
soc_config->get_value_size(); that is, on all chips before T124. Fix the
function not to crash. Better might be to avoid even dumping RSA
parameters on chips which don't support RSA, but that's a larger change
that needs much more work.
Fixes: 3c3b992a68 ("Add support to dump rsa related fields for t210")
Cc: Jimmy Zhang <jimmzhang@nvidia.com>
Signed-off-by: Stephen Warren <swarren@nvidia.com>
This commit is contained in:
@@ -133,10 +133,14 @@ static void format_rsa_param(parse_token id, char const * message, void * data)
|
|||||||
{
|
{
|
||||||
#define MAX_BYTE_NUMBER_PER_LINE 16
|
#define MAX_BYTE_NUMBER_PER_LINE 16
|
||||||
u_int8_t *rsa = (u_int8_t *)data;
|
u_int8_t *rsa = (u_int8_t *)data;
|
||||||
int size = g_soc_config->get_value_size(id);
|
int size, byte_index;
|
||||||
int byte_index;
|
|
||||||
|
|
||||||
printf("%s", message);
|
printf("%s", message);
|
||||||
|
|
||||||
|
if (!g_soc_config->get_value_size)
|
||||||
|
return;
|
||||||
|
|
||||||
|
size = g_soc_config->get_value_size(id);
|
||||||
for (byte_index = 0; byte_index < size; ++byte_index) {
|
for (byte_index = 0; byte_index < size; ++byte_index) {
|
||||||
printf(" %02x", *rsa++);
|
printf(" %02x", *rsa++);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user