Hi,
The tboot build has some warnings in gcc7.
gcc7 warnings now warns about "undeclared" fallthroughs in switches.
it also sees more uninitialized usage of memory.
I fixed both in attached patch.
Ciao, Marcus
--
Marcus Meissner,SUSE LINUX GmbH; Maxfeldstrasse 5; D-90409 Nuernberg; Zi.
3.1-33,+49-911-740 53-432,,serv=loki,mail=wotan,type=real <meiss...@suse.de>
Index: tboot-1.9.5/tboot/common/tboot.c
===================================================================
--- tboot-1.9.5.orig/tboot/common/tboot.c
+++ tboot-1.9.5/tboot/common/tboot.c
@@ -501,11 +501,13 @@ static void shutdown_system(uint32_t shu
/* write our S3 resume vector to ACPI resume addr */
set_s3_resume_vector(&_tboot_shared.acpi_sinfo, TBOOT_S3_WAKEUP_ADDR);
/* fall through for rest of Sx handling */
+ /* FALLTHROUGH */
case TB_SHUTDOWN_S4:
case TB_SHUTDOWN_S5:
machine_sleep(&_tboot_shared.acpi_sinfo);
/* if machine_sleep() fails, fall through to reset */
+ /* FALLTHROUGH */
case TB_SHUTDOWN_REBOOT:
if ( txt_is_powercycle_required() ) {
/* powercycle by writing 0x0a+0x0e to port 0xcf9 */
@@ -524,6 +526,7 @@ static void shutdown_system(uint32_t shu
outb(0xcf9, 0x06);
}
+ /* FALLTHROUGH */
case TB_SHUTDOWN_HALT:
default:
while ( true )
Index: tboot-1.9.5/tboot/common/vsprintf.c
===================================================================
--- tboot-1.9.5.orig/tboot/common/vsprintf.c
+++ tboot-1.9.5/tboot/common/vsprintf.c
@@ -404,6 +404,7 @@ handle_width:
case 'p':
mods.flag |= PREFIX; /* print prefix 0x for %p */
mods.flag_long = LONG;
+ /* FALLTHROUGH */
case 'x':
mods.base = 16;
buf_pos = write_number_to_buffer(buf, size, buf_pos, mods);
Index: tboot-1.9.5/tboot/common/tpm.c
===================================================================
--- tboot-1.9.5.orig/tboot/common/tpm.c
+++ tboot-1.9.5/tboot/common/tpm.c
@@ -117,14 +117,14 @@ static bool tpm_send_cmd_ready_status_cr
#endif
if ( reg_ctrl_sts.tpmidle== 1) {
- reg_ctrl_request._raw[0] = 0;
+ memset(®_ctrl_request,0,sizeof(reg_ctrl_request));
reg_ctrl_request.cmdReady = 1;
write_tpm_reg(locality, TPM_CRB_CTRL_REQ, ®_ctrl_request);
return true;
}
- reg_ctrl_request._raw[0] = 0;
+ memset(®_ctrl_request,0,sizeof(reg_ctrl_request));
reg_ctrl_request.goIdle = 1;
write_tpm_reg(locality, TPM_CRB_CTRL_REQ, ®_ctrl_request);
@@ -158,7 +158,7 @@ static bool tpm_send_cmd_ready_status_cr
printk(TBOOT_INFO"2. reg_ctrl_sts.tpmsts: 0x%x\n", reg_ctrl_sts.tpmsts);
#endif
- reg_ctrl_request._raw[0] = 0;
+ memset(®_ctrl_request,0,sizeof(reg_ctrl_request));
reg_ctrl_request.cmdReady = 1;
write_tpm_reg(locality, TPM_CRB_CTRL_REQ, ®_ctrl_request);
@@ -724,7 +724,7 @@ bool tpm_relinquish_locality_crb(uint32_
if ( reg_loc_state.loc_assigned == 0 ) return true;
/* make inactive by writing a 1 */
- reg_loc_ctrl._raw[0] = 0;
+ memset(®_loc_ctrl,0,sizeof(reg_loc_ctrl));
reg_loc_ctrl.relinquish = 1;
write_tpm_reg(locality, TPM_REG_LOC_CTRL, ®_loc_ctrl);
@@ -778,7 +778,7 @@ bool tpm_request_locality_crb(uint32_t l
tpm_reg_loc_state_t reg_loc_state;
tpm_reg_loc_ctrl_t reg_loc_ctrl;
/* request access to the TPM from locality N */
- reg_loc_ctrl._raw[0] = 0;
+ memset(®_loc_ctrl,0,sizeof(reg_loc_ctrl));
reg_loc_ctrl.requestAccess = 1;
write_tpm_reg(locality, TPM_REG_LOC_CTRL, ®_loc_ctrl);
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
tboot-devel mailing list
tboot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tboot-devel