Skip to content

Commit 64045f9

Browse files
committed
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: 3c3b992 ("Add support to dump rsa related fields for t210") Cc: Jimmy Zhang <jimmzhang@nvidia.com> Signed-off-by: Stephen Warren <swarren@nvidia.com>
1 parent ea1e03d commit 64045f9

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

src/bct_dump.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,10 +133,14 @@ static void format_rsa_param(parse_token id, char const * message, void * data)
133133
{
134134
#define MAX_BYTE_NUMBER_PER_LINE 16
135135
u_int8_t *rsa = (u_int8_t *)data;
136-
int size = g_soc_config->get_value_size(id);
137-
int byte_index;
136+
int size, byte_index;
138137

139138
printf("%s", message);
139+
140+
if (!g_soc_config->get_value_size)
141+
return;
142+
143+
size = g_soc_config->get_value_size(id);
140144
for (byte_index = 0; byte_index < size; ++byte_index) {
141145
printf(" %02x", *rsa++);
142146

0 commit comments

Comments
 (0)