Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mce-amd-smca: update smca_hwid to use smca_bank_types #156

Closed
wants to merge 1 commit into from

Conversation

aristeu
Copy link
Contributor

@aristeu aristeu commented Apr 9, 2024

bank_type is used as smca_bank_types everywhere, there's no point in declaring it as unsigned int. It also upsets covscan:

3. rasdaemon-0.6.7/mce-amd-smca.c:914: assignment: Assigning: "bank_type" = "s_hwid->bank_type".
7. rasdaemon-0.6.7/mce-amd-smca.c:926: cond_at_most: Checking "bank_type >= 64U" implies that "bank_type" and "s_hwid->bank_type" may be up to 63 on the false branch.
14. rasdaemon-0.6.7/mce-amd-smca.c:942: overrun-local: Overrunning array "smca_mce_descs" of 38 16-byte elements at element index 63 (byte offset 1023) using index "bank_type" (which evaluates to 63).
#   940|        /* Only print the descriptor of valid extended error code */
#   941|        if (xec < smca_mce_descs[bank_type].num_descs)
#   942|->              mce_snprintf(e->mcastatus_msg,
#   943|                             "%s. Ext Err Code: %d",
#   944|                             smca_mce_descs[bank_type].descs[xec],

bank_type is used as smca_bank_types everywhere, there's no point in
declaring it as unsigned int. It also upsets covscan:

	3. rasdaemon-0.6.7/mce-amd-smca.c:914: assignment: Assigning: "bank_type" = "s_hwid->bank_type".
	7. rasdaemon-0.6.7/mce-amd-smca.c:926: cond_at_most: Checking "bank_type >= 64U" implies that "bank_type" and "s_hwid->bank_type" may be up to 63 on the false branch.
	14. rasdaemon-0.6.7/mce-amd-smca.c:942: overrun-local: Overrunning array "smca_mce_descs" of 38 16-byte elements at element index 63 (byte offset 1023) using index "bank_type" (which evaluates to 63).
	#   940|        /* Only print the descriptor of valid extended error code */
	#   941|        if (xec < smca_mce_descs[bank_type].num_descs)
	#   942|->              mce_snprintf(e->mcastatus_msg,
	#   943|                             "%s. Ext Err Code: %d",
	#   944|                             smca_mce_descs[bank_type].descs[xec],

Signed-off-by: Aristeu Rozanski <arozansk@redhat.com>
@mchehab
Copy link
Owner

mchehab commented Jun 11, 2024

Merged, thanks!

@mchehab mchehab closed this Jun 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants