Skip to content

Commit 3b2f6bb

Browse files
libmctp-intel: fix tests
Summary: The current revision of code upstream in this repository appears to fail to compile with later versions of GCC. Fix them. ``` | build-halfdome/tmp/work/armv7at2hf-vfp-fb-linux-gnueabi/libmctp-intel/1.0+gitAUTOINC+d530c2271e-r1/git/tests/test_astlpc.c:98:26: error: array subscript 2 is above array bounds of 'uint8_t[2]' {aka 'unsigned char[2]'} [-Werror=array-bounds] | 98 | mmio->kcs[reg] = val; | | ~~~~~~~~~^~~~~ | build-halfdome/tmp/work/armv7at2hf-vfp-fb-linux-gnueabi/libmctp-intel/1.0+gitAUTOINC+d530c2271e-r1/git/tests/test_astlpc.c:63:17: note: while referencing 'kcs' | 63 | uint8_t kcs[2]; ``` Submitted upstream at Intel-BMC/libmctp#1 Test Plan: Build passes. Reviewed By: GoldenBug fbshipit-source-id: d48d3c787bccea767d29de8879c72ac93e20961f
1 parent 5562336 commit 3b2f6bb

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
From 197fb58e40863ad07cc571c7a38e6581f74ee09f Mon Sep 17 00:00:00 2001
2+
From: Patrick Williams <[email protected]>
3+
Date: Mon, 13 Jun 2022 17:12:03 -0500
4+
Subject: [PATCH] test: astlpc: fix compile warning
5+
6+
With the GCC found in openbmc/openbmc master, we are observing the
7+
following:
8+
9+
```
10+
| build-halfdome/tmp/work/armv7at2hf-vfp-fb-linux-gnueabi/libmctp-intel/1.0+gitAUTOINC+d530c2271e-r1/git/tests/test_astlpc.c:98:26: error: array subscript 2 is above array bounds of 'uint8_t[2]' {aka 'unsigned char[2]'} [-Werror=array-bounds]
11+
| 98 | mmio->kcs[reg] = val;
12+
| | ~~~~~~~~~^~~~~
13+
| build-halfdome/tmp/work/armv7at2hf-vfp-fb-linux-gnueabi/libmctp-intel/1.0+gitAUTOINC+d530c2271e-r1/git/tests/test_astlpc.c:63:17: note: while referencing 'kcs'
14+
| 63 | uint8_t kcs[2];
15+
```
16+
17+
Fix this by being explicit about the register access (enum to int map).
18+
---
19+
tests/test_astlpc.c | 2 +-
20+
1 file changed, 1 insertion(+), 1 deletion(-)
21+
22+
diff --git a/tests/test_astlpc.c b/tests/test_astlpc.c
23+
index 0e0dcca..9ecd787 100644
24+
--- a/tests/test_astlpc.c
25+
+++ b/tests/test_astlpc.c
26+
@@ -94,7 +94,7 @@ int mctp_astlpc_mmio_kcs_write(void *data, enum mctp_binding_astlpc_kcs_reg reg,
27+
28+
if (reg == MCTP_ASTLPC_KCS_REG_STATUS)
29+
mmio->kcs[reg] = val & ~0xaU;
30+
- else
31+
+ else if (reg == MCTP_ASTLPC_KCS_REG_DATA)
32+
mmio->kcs[reg] = val;
33+
34+
mctp_prdebug("%s: 0x%hhx to %s", __func__, val,
35+
--
36+
2.31.1
37+

common/recipes-lib/mctp/libmctp-intel_git.bb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ SRC_URI = "git://github.com/Intel-BMC/libmctp.git;protocol=https;branch=master \
1111
file://0001-Remove-unknown-i2c-smbus.h.patch \
1212
file://0002-Build-as-shared-library.patch \
1313
file://0003-Customize-buffer-size.patch \
14+
file://0004-test-astlpc-fix-compile-warning.patch \
1415
"
1516
SRCREV = "d530c2271e1f9ff5d76a170c0abd64bd03ef40fd"
1617
SRC_URI[md5sum] = "1c7db87fb8fa946b03d91fff08b0825a"

0 commit comments

Comments
 (0)