Skip to content

Commit df956fb

Browse files
committed
More peer review fixes
1 parent 5355074 commit df956fb

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

examples/run_examples.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@ wait_for_ready() {
4343
wait_for_port() {
4444
local port="$1" timeout="${2:-500}" elapsed=0
4545
while [ $elapsed -lt $timeout ]; do
46-
if ss -tln 2>/dev/null | grep -q ":${port} "; then
46+
if command -v ss >/dev/null 2>&1; then
47+
ss -tln 2>/dev/null | grep -q ":${port} " && return 0
48+
elif netstat -tln 2>/dev/null | grep -q ":${port} "; then
4749
return 0
4850
fi
4951
sleep 0.01

src/fwtpm/fwtpm_tis.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,8 @@ static void TisHandleRegAccess(FWTPM_CTX* ctx, FWTPM_TIS_REGS* regs)
7878
UINT32 val = 0;
7979
if (len >= 1) val = regs->reg_data[0];
8080
if (len >= 2) val |= (UINT32)regs->reg_data[1] << 8;
81-
if (len >= 4) {
82-
val |= (UINT32)regs->reg_data[2] << 16;
83-
val |= (UINT32)regs->reg_data[3] << 24;
84-
}
81+
if (len >= 3) val |= (UINT32)regs->reg_data[2] << 16;
82+
if (len >= 4) val |= (UINT32)regs->reg_data[3] << 24;
8583

8684
switch (offset) {
8785
case FWTPM_TIS_ACCESS:

src/tpm2_swtpm.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,9 +194,15 @@ static TPM_RC SwTpmConnect(TPM2_CTX* ctx, const char* host, const char* port)
194194
case 38400: baud = B38400; break;
195195
case 57600: baud = B57600; break;
196196
case 115200: baud = B115200; break;
197+
#ifdef B230400
197198
case 230400: baud = B230400; break;
199+
#endif
200+
#ifdef B460800
198201
case 460800: baud = B460800; break;
202+
#endif
203+
#ifdef B921600
199204
case 921600: baud = B921600; break;
205+
#endif
200206
default: baud = B115200; break;
201207
}
202208
cfsetospeed(&tty, baud);

0 commit comments

Comments
 (0)