summaryrefslogtreecommitdiff
path: root/libcr_ipc
diff options
context:
space:
mode:
authorLuke T. Shumaker <lukeshu@lukeshu.com>2025-04-22 18:51:59 -0600
committerLuke T. Shumaker <lukeshu@lukeshu.com>2025-05-06 11:53:17 -0600
commit24e5d0ec1219e2dbb4b9510ef20833092a2b3871 (patch)
tree01bbcc34c6190fa1c35b2625e9ba1744b1447606 /libcr_ipc
parentf09b7435b3a5222597d27238226d23ec0cbd5bd2 (diff)
wip: Build with -Wconversionlukeshu/safe-conversion
I think this found a real bug in the dhcp packet parser. I don't think anything called lib9p_str{,n}() values that could be big enough, but their bounds-checking was broken.
Diffstat (limited to 'libcr_ipc')
-rw-r--r--libcr_ipc/tests/test_select.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/libcr_ipc/tests/test_select.c b/libcr_ipc/tests/test_select.c
index 9b5d117..d8a28c3 100644
--- a/libcr_ipc/tests/test_select.c
+++ b/libcr_ipc/tests/test_select.c
@@ -23,7 +23,7 @@ COROUTINE consumer_cr(void *) {
int arg2ch[10];
for (;;) {
int ret_ch;
- int i_arg = 0;
+ size_t i_arg = 0;
for (int i_ch = 0; i_ch < 10; i_ch++) {
if (!chdone[i_ch]) {
args[i_arg] = CR_SELECT_RECV(&ch[i_ch], &ret_ch);
@@ -35,12 +35,13 @@ COROUTINE consumer_cr(void *) {
break;
args[i_arg] = CR_SELECT_DEFAULT; /* check that default doesn't trigger */
test_assert(i_arg <= 10);
- int ret_arg = cr_select_v(i_arg+1, args);
+ size_t ret_arg = cr_select_v(i_arg+1, args);
test_assert(ret_arg < i_arg);
test_assert(arg2ch[ret_arg] == ret_ch);
chdone[ret_ch] = true;
}
- int ret_ch, ret_arg;
+ int ret_ch;
+ size_t ret_arg;
args[0] = CR_SELECT_RECV(&ch[0], &ret_ch);
args[1] = CR_SELECT_DEFAULT;
ret_arg = cr_select_v(2, args);