summaryrefslogtreecommitdiff
path: root/lib9p
diff options
context:
space:
mode:
Diffstat (limited to 'lib9p')
-rw-r--r--lib9p/core.c21
-rw-r--r--lib9p/core_gen/c_marshal.py4
-rw-r--r--lib9p/core_gen/h.py4
-rw-r--r--lib9p/core_generated.c618
-rw-r--r--lib9p/core_include/lib9p/_core_generated.h4
-rw-r--r--lib9p/core_tables.h2
-rw-r--r--lib9p/srv.c14
-rw-r--r--lib9p/tests/test_server/main.c6
-rw-r--r--lib9p/tests/testclient-sess.c11
9 files changed, 350 insertions, 334 deletions
diff --git a/lib9p/core.c b/lib9p/core.c
index 03cdea5..a0c2f64 100644
--- a/lib9p/core.c
+++ b/lib9p/core.c
@@ -21,16 +21,22 @@
struct lib9p_s lib9p_str(char *s) {
if (!s)
return (struct lib9p_s){0};
+ size_t len = strlen(s);
+ if (len > UINT16_MAX)
+ len = UINT16_MAX;
return (struct lib9p_s){
- .len = strlen(s),
+ .len = LM_SAFEDOWNCAST(uint16_t, len),
.utf8 = s,
};
}
struct lib9p_s lib9p_strn(char *s, size_t maxlen) {
if (maxlen == 0 || !s)
return (struct lib9p_s){0};
+ size_t len = strnlen(s, maxlen);
+ if (len > UINT16_MAX)
+ len = UINT16_MAX;
return (struct lib9p_s){
- .len = strnlen(s, maxlen),
+ .len = LM_SAFEDOWNCAST(uint16_t, len),
.utf8 = s,
};
}
@@ -84,15 +90,15 @@ int _lib9p_errorf(struct lib9p_ctx *ctx,
lib9p_errno_t linux_errno,
#endif
char const *fmt, ...) {
- int n;
+ size_t n;
va_list args;
if (lib9p_ctx_has_error(ctx))
return -1;
va_start(args, fmt);
- n = fmt_vsnprintf(ctx->err_msg, sizeof(ctx->err_msg), fmt, args);
+ n = LM_SAFEDOWNCAST(size_t, fmt_vsnprintf(ctx->err_msg, sizeof(ctx->err_msg), fmt, args));
va_end(args);
- if ((size_t)(n+1) < sizeof(ctx->err_msg))
+ if (n+1 < sizeof(ctx->err_msg))
memset(&ctx->err_msg[n+1], 0, sizeof(ctx->err_msg)-(n+1));
#if CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_9P2000_L
@@ -212,7 +218,7 @@ void lib9p_Rmsg_unmarshal(struct lib9p_ctx *ctx, uint8_t *net_bytes,
static
bool _lib9p_marshal(const struct _lib9p_send_tentry xxx_table[LIB9P_VER_NUM][0x80],
struct lib9p_ctx *ctx, enum lib9p_msg_type typ, void *body,
- size_t *ret_iov_cnt, struct iovec *ret_iov, uint8_t *ret_copied) {
+ int *ret_iov_cnt, struct iovec *ret_iov, uint8_t *ret_copied) {
assert_ver(ctx->version);
assert_typ(typ);
struct _marshal_ret ret = {
@@ -281,6 +287,7 @@ uint32_t lib9p_stat_marshal(struct lib9p_ctx *ctx, uint32_t max_net_size, struct
};
if (_lib9p_stat_marshal(&_ctx, obj, &ret))
return 0;
- return ret.net_iov[0].iov_len;
+ assert(ret.net_iov[0].iov_len);
+ return LM_SAFEDOWNCAST(uint32_t, ret.net_iov[0].iov_len);
}
#endif
diff --git a/lib9p/core_gen/c_marshal.py b/lib9p/core_gen/c_marshal.py
index 322e1ef..581ed92 100644
--- a/lib9p/core_gen/c_marshal.py
+++ b/lib9p/core_gen/c_marshal.py
@@ -78,7 +78,7 @@ class OffsetExpr:
if dsttyp:
if not oneline:
oneline.append("0")
- ret += f"{'\t'*indent_depth}{dsttyp} {dstvar} = {' + '.join(oneline)};\n"
+ ret += f"{'\t'*indent_depth}{dsttyp} {dstvar} = LM_SAFEDOWNCAST({dsttyp}, {' + '.join(oneline)});\n"
elif oneline:
ret += f"{'\t'*indent_depth}{dstvar} += {' + '.join(oneline)};\n"
ret += multiline
@@ -350,6 +350,8 @@ def gen_c_marshal(versions: set[str], typs: list[idl.UserType]) -> str:
return f"offsetof{''.join('_'+m.membname for m in path.elems[:-1])}_{sym}"
val = c9util.idl_expr(child.val, lookup_sym)
+ if child.typ.static_size < 32:
+ val = f"LM_SAFEDOWNCAST(uint{child.typ.static_size*8}_t, {val})"
else:
val = path.c_str("val->")
if isinstance(child.typ, idl.Bitfield):
diff --git a/lib9p/core_gen/h.py b/lib9p/core_gen/h.py
index 61775c1..378fc06 100644
--- a/lib9p/core_gen/h.py
+++ b/lib9p/core_gen/h.py
@@ -354,14 +354,14 @@ enum {c9util.ident('version')} {{
ret += "\n"
ret += f"struct {c9util.ident('Tmsg_send_buf')} {{\n"
- ret += "\tsize_t iov_cnt;\n"
+ ret += "\tint iov_cnt;\n"
ret += f"\tstruct iovec iov[{c9util.IDENT('TMSG_MAX_IOV')}];\n"
ret += f"\tuint8_t copied[{c9util.IDENT('TMSG_MAX_COPY')}];\n"
ret += "};\n"
ret += "\n"
ret += f"struct {c9util.ident('Rmsg_send_buf')} {{\n"
- ret += "\tsize_t iov_cnt;\n"
+ ret += "\tint iov_cnt;\n"
ret += f"\tstruct iovec iov[{c9util.IDENT('RMSG_MAX_IOV')}];\n"
ret += f"\tuint8_t copied[{c9util.IDENT('RMSG_MAX_COPY')}];\n"
ret += "};\n"
diff --git a/lib9p/core_generated.c b/lib9p/core_generated.c
index c8896b9..ffef2c4 100644
--- a/lib9p/core_generated.c
+++ b/lib9p/core_generated.c
@@ -3011,7 +3011,7 @@ static void unmarshal_Rswrite([[maybe_unused]] struct lib9p_ctx *ctx, uint8_t *n
#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u
static bool marshal_stat(struct lib9p_ctx *ctx, struct lib9p_stat *val, struct _marshal_ret *ret) {
- uint32_t needed_size = 49 + val->name.len + val->owner_uname.len + val->owner_gname.len + val->last_modifier_uname.len;
+ uint32_t needed_size = (uint32_t)(49 + val->name.len + val->owner_uname.len + val->owner_gname.len + val->last_modifier_uname.len);
#if CONFIG_9P_ENABLE_9P2000_u
if is_ver(ctx, 9P2000_u) {
needed_size += 14 + val->extension.len;
@@ -3021,8 +3021,8 @@ static bool marshal_stat(struct lib9p_ctx *ctx, struct lib9p_stat *val, struct _
return true;
}
uint32_t offsetof_end = needed_size;
- uint32_t offsetof_fstype = 2;
- MARSHAL_U16LE(ctx, offsetof_end - offsetof_fstype);
+ uint32_t offsetof_fstype = (uint32_t)(2);
+ MARSHAL_U16LE(ctx, (uint16_t)(offsetof_end - offsetof_fstype));
MARSHAL_U16LE(ctx, val->fstype);
MARSHAL_U32LE(ctx, val->fsdev);
MARSHAL_U8LE(ctx, val->qid.type & qt_masks[ctx->version]);
@@ -3055,7 +3055,7 @@ static bool marshal_stat(struct lib9p_ctx *ctx, struct lib9p_stat *val, struct _
#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u */
#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_uninitialized
static bool marshal_Tversion(struct lib9p_ctx *ctx, struct lib9p_msg_Tversion *val, struct _marshal_ret *ret) {
- uint32_t needed_size = 13 + val->version.len;
+ uint32_t needed_size = (uint32_t)(13 + val->version.len);
if (needed_size > ctx->max_msg_size) {
lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")",
"Tversion",
@@ -3064,9 +3064,9 @@ static bool marshal_Tversion(struct lib9p_ctx *ctx, struct lib9p_msg_Tversion *v
return true;
}
uint32_t offsetof_end = needed_size;
- uint32_t offsetof_size = 0;
- MARSHAL_U32LE(ctx, offsetof_end - offsetof_size);
- MARSHAL_U8LE(ctx, 100);
+ uint32_t offsetof_size = (uint32_t)(0);
+ MARSHAL_U32LE(ctx, (uint32_t)(offsetof_end - offsetof_size));
+ MARSHAL_U8LE(ctx, (uint8_t)(100));
MARSHAL_U16LE(ctx, val->tag);
MARSHAL_U32LE(ctx, val->max_msg_size);
MARSHAL_U16LE(ctx, val->version.len);
@@ -3075,7 +3075,7 @@ static bool marshal_Tversion(struct lib9p_ctx *ctx, struct lib9p_msg_Tversion *v
}
static bool marshal_Rversion(struct lib9p_ctx *ctx, struct lib9p_msg_Rversion *val, struct _marshal_ret *ret) {
- uint32_t needed_size = 13 + val->version.len;
+ uint32_t needed_size = (uint32_t)(13 + val->version.len);
if (needed_size > ctx->max_msg_size) {
lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")",
"Rversion",
@@ -3084,9 +3084,9 @@ static bool marshal_Rversion(struct lib9p_ctx *ctx, struct lib9p_msg_Rversion *v
return true;
}
uint32_t offsetof_end = needed_size;
- uint32_t offsetof_size = 0;
- MARSHAL_U32LE(ctx, offsetof_end - offsetof_size);
- MARSHAL_U8LE(ctx, 101);
+ uint32_t offsetof_size = (uint32_t)(0);
+ MARSHAL_U32LE(ctx, (uint32_t)(offsetof_end - offsetof_size));
+ MARSHAL_U8LE(ctx, (uint8_t)(101));
MARSHAL_U16LE(ctx, val->tag);
MARSHAL_U32LE(ctx, val->max_msg_size);
MARSHAL_U16LE(ctx, val->version.len);
@@ -3097,7 +3097,7 @@ static bool marshal_Rversion(struct lib9p_ctx *ctx, struct lib9p_msg_Rversion *v
#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_uninitialized */
#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u
static bool marshal_Tauth(struct lib9p_ctx *ctx, struct lib9p_msg_Tauth *val, struct _marshal_ret *ret) {
- uint32_t needed_size = 15 + val->uname.len + val->aname.len;
+ uint32_t needed_size = (uint32_t)(15 + val->uname.len + val->aname.len);
#if CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_u
if ( is_ver(ctx, 9P2000_L) || is_ver(ctx, 9P2000_u) ) {
needed_size += 4;
@@ -3111,9 +3111,9 @@ static bool marshal_Tauth(struct lib9p_ctx *ctx, struct lib9p_msg_Tauth *val, st
return true;
}
uint32_t offsetof_end = needed_size;
- uint32_t offsetof_size = 0;
- MARSHAL_U32LE(ctx, offsetof_end - offsetof_size);
- MARSHAL_U8LE(ctx, 102);
+ uint32_t offsetof_size = (uint32_t)(0);
+ MARSHAL_U32LE(ctx, (uint32_t)(offsetof_end - offsetof_size));
+ MARSHAL_U8LE(ctx, (uint8_t)(102));
MARSHAL_U16LE(ctx, val->tag);
MARSHAL_U32LE(ctx, val->afid);
MARSHAL_U16LE(ctx, val->uname.len);
@@ -3129,7 +3129,7 @@ static bool marshal_Tauth(struct lib9p_ctx *ctx, struct lib9p_msg_Tauth *val, st
}
static bool marshal_Rauth(struct lib9p_ctx *ctx, struct lib9p_msg_Rauth *val, struct _marshal_ret *ret) {
- uint32_t needed_size = 20;
+ uint32_t needed_size = (uint32_t)(20);
if (needed_size > ctx->max_msg_size) {
lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")",
"Rauth",
@@ -3138,9 +3138,9 @@ static bool marshal_Rauth(struct lib9p_ctx *ctx, struct lib9p_msg_Rauth *val, st
return true;
}
uint32_t offsetof_end = needed_size;
- uint32_t offsetof_size = 0;
- MARSHAL_U32LE(ctx, offsetof_end - offsetof_size);
- MARSHAL_U8LE(ctx, 103);
+ uint32_t offsetof_size = (uint32_t)(0);
+ MARSHAL_U32LE(ctx, (uint32_t)(offsetof_end - offsetof_size));
+ MARSHAL_U8LE(ctx, (uint8_t)(103));
MARSHAL_U16LE(ctx, val->tag);
MARSHAL_U8LE(ctx, val->aqid.type & qt_masks[ctx->version]);
MARSHAL_U32LE(ctx, val->aqid.vers);
@@ -3149,7 +3149,7 @@ static bool marshal_Rauth(struct lib9p_ctx *ctx, struct lib9p_msg_Rauth *val, st
}
static bool marshal_Tattach(struct lib9p_ctx *ctx, struct lib9p_msg_Tattach *val, struct _marshal_ret *ret) {
- uint32_t needed_size = 19 + val->uname.len + val->aname.len;
+ uint32_t needed_size = (uint32_t)(19 + val->uname.len + val->aname.len);
#if CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_u
if ( is_ver(ctx, 9P2000_L) || is_ver(ctx, 9P2000_u) ) {
needed_size += 4;
@@ -3163,9 +3163,9 @@ static bool marshal_Tattach(struct lib9p_ctx *ctx, struct lib9p_msg_Tattach *val
return true;
}
uint32_t offsetof_end = needed_size;
- uint32_t offsetof_size = 0;
- MARSHAL_U32LE(ctx, offsetof_end - offsetof_size);
- MARSHAL_U8LE(ctx, 104);
+ uint32_t offsetof_size = (uint32_t)(0);
+ MARSHAL_U32LE(ctx, (uint32_t)(offsetof_end - offsetof_size));
+ MARSHAL_U8LE(ctx, (uint8_t)(104));
MARSHAL_U16LE(ctx, val->tag);
MARSHAL_U32LE(ctx, val->fid);
MARSHAL_U32LE(ctx, val->afid);
@@ -3182,7 +3182,7 @@ static bool marshal_Tattach(struct lib9p_ctx *ctx, struct lib9p_msg_Tattach *val
}
static bool marshal_Rattach(struct lib9p_ctx *ctx, struct lib9p_msg_Rattach *val, struct _marshal_ret *ret) {
- uint32_t needed_size = 20;
+ uint32_t needed_size = (uint32_t)(20);
if (needed_size > ctx->max_msg_size) {
lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")",
"Rattach",
@@ -3191,9 +3191,9 @@ static bool marshal_Rattach(struct lib9p_ctx *ctx, struct lib9p_msg_Rattach *val
return true;
}
uint32_t offsetof_end = needed_size;
- uint32_t offsetof_size = 0;
- MARSHAL_U32LE(ctx, offsetof_end - offsetof_size);
- MARSHAL_U8LE(ctx, 105);
+ uint32_t offsetof_size = (uint32_t)(0);
+ MARSHAL_U32LE(ctx, (uint32_t)(offsetof_end - offsetof_size));
+ MARSHAL_U8LE(ctx, (uint8_t)(105));
MARSHAL_U16LE(ctx, val->tag);
MARSHAL_U8LE(ctx, val->qid.type & qt_masks[ctx->version]);
MARSHAL_U32LE(ctx, val->qid.vers);
@@ -3204,7 +3204,7 @@ static bool marshal_Rattach(struct lib9p_ctx *ctx, struct lib9p_msg_Rattach *val
#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u */
#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_uninitialized
static bool marshal_Rerror(struct lib9p_ctx *ctx, struct lib9p_msg_Rerror *val, struct _marshal_ret *ret) {
- uint32_t needed_size = 9 + val->errstr.len;
+ uint32_t needed_size = (uint32_t)(9 + val->errstr.len);
#if CONFIG_9P_ENABLE_9P2000_u
if is_ver(ctx, 9P2000_u) {
needed_size += 4;
@@ -3218,9 +3218,9 @@ static bool marshal_Rerror(struct lib9p_ctx *ctx, struct lib9p_msg_Rerror *val,
return true;
}
uint32_t offsetof_end = needed_size;
- uint32_t offsetof_size = 0;
- MARSHAL_U32LE(ctx, offsetof_end - offsetof_size);
- MARSHAL_U8LE(ctx, 107);
+ uint32_t offsetof_size = (uint32_t)(0);
+ MARSHAL_U32LE(ctx, (uint32_t)(offsetof_end - offsetof_size));
+ MARSHAL_U8LE(ctx, (uint8_t)(107));
MARSHAL_U16LE(ctx, val->tag);
MARSHAL_U16LE(ctx, val->errstr.len);
MARSHAL_BYTES_ZEROCOPY(ctx, val->errstr.utf8, val->errstr.len);
@@ -3235,7 +3235,7 @@ static bool marshal_Rerror(struct lib9p_ctx *ctx, struct lib9p_msg_Rerror *val,
#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_uninitialized */
#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u
static bool marshal_Tflush(struct lib9p_ctx *ctx, struct lib9p_msg_Tflush *val, struct _marshal_ret *ret) {
- uint32_t needed_size = 9;
+ uint32_t needed_size = (uint32_t)(9);
if (needed_size > ctx->max_msg_size) {
lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")",
"Tflush",
@@ -3244,16 +3244,16 @@ static bool marshal_Tflush(struct lib9p_ctx *ctx, struct lib9p_msg_Tflush *val,
return true;
}
uint32_t offsetof_end = needed_size;
- uint32_t offsetof_size = 0;
- MARSHAL_U32LE(ctx, offsetof_end - offsetof_size);
- MARSHAL_U8LE(ctx, 108);
+ uint32_t offsetof_size = (uint32_t)(0);
+ MARSHAL_U32LE(ctx, (uint32_t)(offsetof_end - offsetof_size));
+ MARSHAL_U8LE(ctx, (uint8_t)(108));
MARSHAL_U16LE(ctx, val->tag);
MARSHAL_U16LE(ctx, val->oldtag);
return false;
}
static bool marshal_Rflush(struct lib9p_ctx *ctx, struct lib9p_msg_Rflush *val, struct _marshal_ret *ret) {
- uint32_t needed_size = 7;
+ uint32_t needed_size = (uint32_t)(7);
if (needed_size > ctx->max_msg_size) {
lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")",
"Rflush",
@@ -3262,15 +3262,15 @@ static bool marshal_Rflush(struct lib9p_ctx *ctx, struct lib9p_msg_Rflush *val,
return true;
}
uint32_t offsetof_end = needed_size;
- uint32_t offsetof_size = 0;
- MARSHAL_U32LE(ctx, offsetof_end - offsetof_size);
- MARSHAL_U8LE(ctx, 109);
+ uint32_t offsetof_size = (uint32_t)(0);
+ MARSHAL_U32LE(ctx, (uint32_t)(offsetof_end - offsetof_size));
+ MARSHAL_U8LE(ctx, (uint8_t)(109));
MARSHAL_U16LE(ctx, val->tag);
return false;
}
static bool marshal_Twalk(struct lib9p_ctx *ctx, struct lib9p_msg_Twalk *val, struct _marshal_ret *ret) {
- uint32_t needed_size = 17;
+ uint32_t needed_size = (uint32_t)(17);
for (uint16_t i = 0; i < val->nwname; i++) {
needed_size += 2 + val->wname[i].len;
}
@@ -3282,9 +3282,9 @@ static bool marshal_Twalk(struct lib9p_ctx *ctx, struct lib9p_msg_Twalk *val, st
return true;
}
uint32_t offsetof_end = needed_size;
- uint32_t offsetof_size = 0;
- MARSHAL_U32LE(ctx, offsetof_end - offsetof_size);
- MARSHAL_U8LE(ctx, 110);
+ uint32_t offsetof_size = (uint32_t)(0);
+ MARSHAL_U32LE(ctx, (uint32_t)(offsetof_end - offsetof_size));
+ MARSHAL_U8LE(ctx, (uint8_t)(110));
MARSHAL_U16LE(ctx, val->tag);
MARSHAL_U32LE(ctx, val->fid);
MARSHAL_U32LE(ctx, val->newfid);
@@ -3297,7 +3297,7 @@ static bool marshal_Twalk(struct lib9p_ctx *ctx, struct lib9p_msg_Twalk *val, st
}
static bool marshal_Rwalk(struct lib9p_ctx *ctx, struct lib9p_msg_Rwalk *val, struct _marshal_ret *ret) {
- uint32_t needed_size = 9 + (val->nwqid)*13;
+ uint32_t needed_size = (uint32_t)(9 + (val->nwqid)*13);
if (needed_size > ctx->max_msg_size) {
lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")",
"Rwalk",
@@ -3306,9 +3306,9 @@ static bool marshal_Rwalk(struct lib9p_ctx *ctx, struct lib9p_msg_Rwalk *val, st
return true;
}
uint32_t offsetof_end = needed_size;
- uint32_t offsetof_size = 0;
- MARSHAL_U32LE(ctx, offsetof_end - offsetof_size);
- MARSHAL_U8LE(ctx, 111);
+ uint32_t offsetof_size = (uint32_t)(0);
+ MARSHAL_U32LE(ctx, (uint32_t)(offsetof_end - offsetof_size));
+ MARSHAL_U8LE(ctx, (uint8_t)(111));
MARSHAL_U16LE(ctx, val->tag);
MARSHAL_U16LE(ctx, val->nwqid);
for (uint16_t i = 0; i < val->nwqid; i++) {
@@ -3322,7 +3322,7 @@ static bool marshal_Rwalk(struct lib9p_ctx *ctx, struct lib9p_msg_Rwalk *val, st
#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u */
#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u
static bool marshal_Topen(struct lib9p_ctx *ctx, struct lib9p_msg_Topen *val, struct _marshal_ret *ret) {
- uint32_t needed_size = 12;
+ uint32_t needed_size = (uint32_t)(12);
if (needed_size > ctx->max_msg_size) {
lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")",
"Topen",
@@ -3331,9 +3331,9 @@ static bool marshal_Topen(struct lib9p_ctx *ctx, struct lib9p_msg_Topen *val, st
return true;
}
uint32_t offsetof_end = needed_size;
- uint32_t offsetof_size = 0;
- MARSHAL_U32LE(ctx, offsetof_end - offsetof_size);
- MARSHAL_U8LE(ctx, 112);
+ uint32_t offsetof_size = (uint32_t)(0);
+ MARSHAL_U32LE(ctx, (uint32_t)(offsetof_end - offsetof_size));
+ MARSHAL_U8LE(ctx, (uint8_t)(112));
MARSHAL_U16LE(ctx, val->tag);
MARSHAL_U32LE(ctx, val->fid);
MARSHAL_U8LE(ctx, val->mode & o_masks[ctx->version]);
@@ -3341,7 +3341,7 @@ static bool marshal_Topen(struct lib9p_ctx *ctx, struct lib9p_msg_Topen *val, st
}
static bool marshal_Ropen(struct lib9p_ctx *ctx, struct lib9p_msg_Ropen *val, struct _marshal_ret *ret) {
- uint32_t needed_size = 24;
+ uint32_t needed_size = (uint32_t)(24);
if (needed_size > ctx->max_msg_size) {
lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")",
"Ropen",
@@ -3350,9 +3350,9 @@ static bool marshal_Ropen(struct lib9p_ctx *ctx, struct lib9p_msg_Ropen *val, st
return true;
}
uint32_t offsetof_end = needed_size;
- uint32_t offsetof_size = 0;
- MARSHAL_U32LE(ctx, offsetof_end - offsetof_size);
- MARSHAL_U8LE(ctx, 113);
+ uint32_t offsetof_size = (uint32_t)(0);
+ MARSHAL_U32LE(ctx, (uint32_t)(offsetof_end - offsetof_size));
+ MARSHAL_U8LE(ctx, (uint8_t)(113));
MARSHAL_U16LE(ctx, val->tag);
MARSHAL_U8LE(ctx, val->qid.type & qt_masks[ctx->version]);
MARSHAL_U32LE(ctx, val->qid.vers);
@@ -3362,7 +3362,7 @@ static bool marshal_Ropen(struct lib9p_ctx *ctx, struct lib9p_msg_Ropen *val, st
}
static bool marshal_Tcreate(struct lib9p_ctx *ctx, struct lib9p_msg_Tcreate *val, struct _marshal_ret *ret) {
- uint32_t needed_size = 18 + val->name.len;
+ uint32_t needed_size = (uint32_t)(18 + val->name.len);
if (needed_size > ctx->max_msg_size) {
lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")",
"Tcreate",
@@ -3371,9 +3371,9 @@ static bool marshal_Tcreate(struct lib9p_ctx *ctx, struct lib9p_msg_Tcreate *val
return true;
}
uint32_t offsetof_end = needed_size;
- uint32_t offsetof_size = 0;
- MARSHAL_U32LE(ctx, offsetof_end - offsetof_size);
- MARSHAL_U8LE(ctx, 114);
+ uint32_t offsetof_size = (uint32_t)(0);
+ MARSHAL_U32LE(ctx, (uint32_t)(offsetof_end - offsetof_size));
+ MARSHAL_U8LE(ctx, (uint8_t)(114));
MARSHAL_U16LE(ctx, val->tag);
MARSHAL_U32LE(ctx, val->fid);
MARSHAL_U16LE(ctx, val->name.len);
@@ -3384,7 +3384,7 @@ static bool marshal_Tcreate(struct lib9p_ctx *ctx, struct lib9p_msg_Tcreate *val
}
static bool marshal_Rcreate(struct lib9p_ctx *ctx, struct lib9p_msg_Rcreate *val, struct _marshal_ret *ret) {
- uint32_t needed_size = 24;
+ uint32_t needed_size = (uint32_t)(24);
if (needed_size > ctx->max_msg_size) {
lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")",
"Rcreate",
@@ -3393,9 +3393,9 @@ static bool marshal_Rcreate(struct lib9p_ctx *ctx, struct lib9p_msg_Rcreate *val
return true;
}
uint32_t offsetof_end = needed_size;
- uint32_t offsetof_size = 0;
- MARSHAL_U32LE(ctx, offsetof_end - offsetof_size);
- MARSHAL_U8LE(ctx, 115);
+ uint32_t offsetof_size = (uint32_t)(0);
+ MARSHAL_U32LE(ctx, (uint32_t)(offsetof_end - offsetof_size));
+ MARSHAL_U8LE(ctx, (uint8_t)(115));
MARSHAL_U16LE(ctx, val->tag);
MARSHAL_U8LE(ctx, val->qid.type & qt_masks[ctx->version]);
MARSHAL_U32LE(ctx, val->qid.vers);
@@ -3407,7 +3407,7 @@ static bool marshal_Rcreate(struct lib9p_ctx *ctx, struct lib9p_msg_Rcreate *val
#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u */
#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u
static bool marshal_Tread(struct lib9p_ctx *ctx, struct lib9p_msg_Tread *val, struct _marshal_ret *ret) {
- uint32_t needed_size = 23;
+ uint32_t needed_size = (uint32_t)(23);
if (needed_size > ctx->max_msg_size) {
lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")",
"Tread",
@@ -3416,9 +3416,9 @@ static bool marshal_Tread(struct lib9p_ctx *ctx, struct lib9p_msg_Tread *val, st
return true;
}
uint32_t offsetof_end = needed_size;
- uint32_t offsetof_size = 0;
- MARSHAL_U32LE(ctx, offsetof_end - offsetof_size);
- MARSHAL_U8LE(ctx, 116);
+ uint32_t offsetof_size = (uint32_t)(0);
+ MARSHAL_U32LE(ctx, (uint32_t)(offsetof_end - offsetof_size));
+ MARSHAL_U8LE(ctx, (uint8_t)(116));
MARSHAL_U16LE(ctx, val->tag);
MARSHAL_U32LE(ctx, val->fid);
MARSHAL_U64LE(ctx, val->offset);
@@ -3427,7 +3427,7 @@ static bool marshal_Tread(struct lib9p_ctx *ctx, struct lib9p_msg_Tread *val, st
}
static bool marshal_Rread(struct lib9p_ctx *ctx, struct lib9p_msg_Rread *val, struct _marshal_ret *ret) {
- uint32_t needed_size = 11 + val->count;
+ uint32_t needed_size = (uint32_t)(11 + val->count);
if (needed_size > ctx->max_msg_size) {
lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")",
"Rread",
@@ -3436,9 +3436,9 @@ static bool marshal_Rread(struct lib9p_ctx *ctx, struct lib9p_msg_Rread *val, st
return true;
}
uint32_t offsetof_end = needed_size;
- uint32_t offsetof_size = 0;
- MARSHAL_U32LE(ctx, offsetof_end - offsetof_size);
- MARSHAL_U8LE(ctx, 117);
+ uint32_t offsetof_size = (uint32_t)(0);
+ MARSHAL_U32LE(ctx, (uint32_t)(offsetof_end - offsetof_size));
+ MARSHAL_U8LE(ctx, (uint8_t)(117));
MARSHAL_U16LE(ctx, val->tag);
MARSHAL_U32LE(ctx, val->count);
MARSHAL_BYTES_ZEROCOPY(ctx, val->data, val->count);
@@ -3446,7 +3446,7 @@ static bool marshal_Rread(struct lib9p_ctx *ctx, struct lib9p_msg_Rread *val, st
}
static bool marshal_Twrite(struct lib9p_ctx *ctx, struct lib9p_msg_Twrite *val, struct _marshal_ret *ret) {
- uint32_t needed_size = 23 + val->count;
+ uint32_t needed_size = (uint32_t)(23 + val->count);
if (needed_size > ctx->max_msg_size) {
lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")",
"Twrite",
@@ -3455,9 +3455,9 @@ static bool marshal_Twrite(struct lib9p_ctx *ctx, struct lib9p_msg_Twrite *val,
return true;
}
uint32_t offsetof_end = needed_size;
- uint32_t offsetof_size = 0;
- MARSHAL_U32LE(ctx, offsetof_end - offsetof_size);
- MARSHAL_U8LE(ctx, 118);
+ uint32_t offsetof_size = (uint32_t)(0);
+ MARSHAL_U32LE(ctx, (uint32_t)(offsetof_end - offsetof_size));
+ MARSHAL_U8LE(ctx, (uint8_t)(118));
MARSHAL_U16LE(ctx, val->tag);
MARSHAL_U32LE(ctx, val->fid);
MARSHAL_U64LE(ctx, val->offset);
@@ -3467,7 +3467,7 @@ static bool marshal_Twrite(struct lib9p_ctx *ctx, struct lib9p_msg_Twrite *val,
}
static bool marshal_Rwrite(struct lib9p_ctx *ctx, struct lib9p_msg_Rwrite *val, struct _marshal_ret *ret) {
- uint32_t needed_size = 11;
+ uint32_t needed_size = (uint32_t)(11);
if (needed_size > ctx->max_msg_size) {
lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")",
"Rwrite",
@@ -3476,16 +3476,16 @@ static bool marshal_Rwrite(struct lib9p_ctx *ctx, struct lib9p_msg_Rwrite *val,
return true;
}
uint32_t offsetof_end = needed_size;
- uint32_t offsetof_size = 0;
- MARSHAL_U32LE(ctx, offsetof_end - offsetof_size);
- MARSHAL_U8LE(ctx, 119);
+ uint32_t offsetof_size = (uint32_t)(0);
+ MARSHAL_U32LE(ctx, (uint32_t)(offsetof_end - offsetof_size));
+ MARSHAL_U8LE(ctx, (uint8_t)(119));
MARSHAL_U16LE(ctx, val->tag);
MARSHAL_U32LE(ctx, val->count);
return false;
}
static bool marshal_Tclunk(struct lib9p_ctx *ctx, struct lib9p_msg_Tclunk *val, struct _marshal_ret *ret) {
- uint32_t needed_size = 11;
+ uint32_t needed_size = (uint32_t)(11);
if (needed_size > ctx->max_msg_size) {
lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")",
"Tclunk",
@@ -3494,16 +3494,16 @@ static bool marshal_Tclunk(struct lib9p_ctx *ctx, struct lib9p_msg_Tclunk *val,
return true;
}
uint32_t offsetof_end = needed_size;
- uint32_t offsetof_size = 0;
- MARSHAL_U32LE(ctx, offsetof_end - offsetof_size);
- MARSHAL_U8LE(ctx, 120);
+ uint32_t offsetof_size = (uint32_t)(0);
+ MARSHAL_U32LE(ctx, (uint32_t)(offsetof_end - offsetof_size));
+ MARSHAL_U8LE(ctx, (uint8_t)(120));
MARSHAL_U16LE(ctx, val->tag);
MARSHAL_U32LE(ctx, val->fid);
return false;
}
static bool marshal_Rclunk(struct lib9p_ctx *ctx, struct lib9p_msg_Rclunk *val, struct _marshal_ret *ret) {
- uint32_t needed_size = 7;
+ uint32_t needed_size = (uint32_t)(7);
if (needed_size > ctx->max_msg_size) {
lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")",
"Rclunk",
@@ -3512,15 +3512,15 @@ static bool marshal_Rclunk(struct lib9p_ctx *ctx, struct lib9p_msg_Rclunk *val,
return true;
}
uint32_t offsetof_end = needed_size;
- uint32_t offsetof_size = 0;
- MARSHAL_U32LE(ctx, offsetof_end - offsetof_size);
- MARSHAL_U8LE(ctx, 121);
+ uint32_t offsetof_size = (uint32_t)(0);
+ MARSHAL_U32LE(ctx, (uint32_t)(offsetof_end - offsetof_size));
+ MARSHAL_U8LE(ctx, (uint8_t)(121));
MARSHAL_U16LE(ctx, val->tag);
return false;
}
static bool marshal_Tremove(struct lib9p_ctx *ctx, struct lib9p_msg_Tremove *val, struct _marshal_ret *ret) {
- uint32_t needed_size = 11;
+ uint32_t needed_size = (uint32_t)(11);
if (needed_size > ctx->max_msg_size) {
lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")",
"Tremove",
@@ -3529,16 +3529,16 @@ static bool marshal_Tremove(struct lib9p_ctx *ctx, struct lib9p_msg_Tremove *val
return true;
}
uint32_t offsetof_end = needed_size;
- uint32_t offsetof_size = 0;
- MARSHAL_U32LE(ctx, offsetof_end - offsetof_size);
- MARSHAL_U8LE(ctx, 122);
+ uint32_t offsetof_size = (uint32_t)(0);
+ MARSHAL_U32LE(ctx, (uint32_t)(offsetof_end - offsetof_size));
+ MARSHAL_U8LE(ctx, (uint8_t)(122));
MARSHAL_U16LE(ctx, val->tag);
MARSHAL_U32LE(ctx, val->fid);
return false;
}
static bool marshal_Rremove(struct lib9p_ctx *ctx, struct lib9p_msg_Rremove *val, struct _marshal_ret *ret) {
- uint32_t needed_size = 7;
+ uint32_t needed_size = (uint32_t)(7);
if (needed_size > ctx->max_msg_size) {
lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")",
"Rremove",
@@ -3547,9 +3547,9 @@ static bool marshal_Rremove(struct lib9p_ctx *ctx, struct lib9p_msg_Rremove *val
return true;
}
uint32_t offsetof_end = needed_size;
- uint32_t offsetof_size = 0;
- MARSHAL_U32LE(ctx, offsetof_end - offsetof_size);
- MARSHAL_U8LE(ctx, 123);
+ uint32_t offsetof_size = (uint32_t)(0);
+ MARSHAL_U32LE(ctx, (uint32_t)(offsetof_end - offsetof_size));
+ MARSHAL_U8LE(ctx, (uint8_t)(123));
MARSHAL_U16LE(ctx, val->tag);
return false;
}
@@ -3557,7 +3557,7 @@ static bool marshal_Rremove(struct lib9p_ctx *ctx, struct lib9p_msg_Rremove *val
#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_L || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u */
#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u
static bool marshal_Tstat(struct lib9p_ctx *ctx, struct lib9p_msg_Tstat *val, struct _marshal_ret *ret) {
- uint32_t needed_size = 11;
+ uint32_t needed_size = (uint32_t)(11);
if (needed_size > ctx->max_msg_size) {
lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")",
"Tstat",
@@ -3566,16 +3566,16 @@ static bool marshal_Tstat(struct lib9p_ctx *ctx, struct lib9p_msg_Tstat *val, st
return true;
}
uint32_t offsetof_end = needed_size;
- uint32_t offsetof_size = 0;
- MARSHAL_U32LE(ctx, offsetof_end - offsetof_size);
- MARSHAL_U8LE(ctx, 124);
+ uint32_t offsetof_size = (uint32_t)(0);
+ MARSHAL_U32LE(ctx, (uint32_t)(offsetof_end - offsetof_size));
+ MARSHAL_U8LE(ctx, (uint8_t)(124));
MARSHAL_U16LE(ctx, val->tag);
MARSHAL_U32LE(ctx, val->fid);
return false;
}
static bool marshal_Rstat(struct lib9p_ctx *ctx, struct lib9p_msg_Rstat *val, struct _marshal_ret *ret) {
- uint32_t needed_size = 58 + val->stat.name.len + val->stat.owner_uname.len + val->stat.owner_gname.len + val->stat.last_modifier_uname.len;
+ uint32_t needed_size = (uint32_t)(58 + val->stat.name.len + val->stat.owner_uname.len + val->stat.owner_gname.len + val->stat.last_modifier_uname.len);
#if CONFIG_9P_ENABLE_9P2000_u
if is_ver(ctx, 9P2000_u) {
needed_size += 14 + val->stat.extension.len;
@@ -3589,20 +3589,20 @@ static bool marshal_Rstat(struct lib9p_ctx *ctx, struct lib9p_msg_Rstat *val, st
return true;
}
uint32_t offsetof_end = needed_size;
- uint32_t offsetof_size = 0;
- uint32_t offsetof_stat = 9;
- MARSHAL_U32LE(ctx, offsetof_end - offsetof_size);
- MARSHAL_U8LE(ctx, 125);
+ uint32_t offsetof_size = (uint32_t)(0);
+ uint32_t offsetof_stat = (uint32_t)(9);
+ MARSHAL_U32LE(ctx, (uint32_t)(offsetof_end - offsetof_size));
+ MARSHAL_U8LE(ctx, (uint8_t)(125));
MARSHAL_U16LE(ctx, val->tag);
- MARSHAL_U16LE(ctx, offsetof_end - offsetof_stat);
- uint32_t offsetof_stat_end = 49 + val->stat.name.len + val->stat.owner_uname.len + val->stat.owner_gname.len + val->stat.last_modifier_uname.len;
+ MARSHAL_U16LE(ctx, (uint16_t)(offsetof_end - offsetof_stat));
+ uint32_t offsetof_stat_end = (uint32_t)(49 + val->stat.name.len + val->stat.owner_uname.len + val->stat.owner_gname.len + val->stat.last_modifier_uname.len);
#if CONFIG_9P_ENABLE_9P2000_u
if is_ver(ctx, 9P2000_u) {
offsetof_stat_end += 14 + val->stat.extension.len;
}
#endif /* CONFIG_9P_ENABLE_9P2000_u */
- uint32_t offsetof_stat_fstype = 2;
- MARSHAL_U16LE(ctx, offsetof_stat_end - offsetof_stat_fstype);
+ uint32_t offsetof_stat_fstype = (uint32_t)(2);
+ MARSHAL_U16LE(ctx, (uint16_t)(offsetof_stat_end - offsetof_stat_fstype));
MARSHAL_U16LE(ctx, val->stat.fstype);
MARSHAL_U32LE(ctx, val->stat.fsdev);
MARSHAL_U8LE(ctx, val->stat.qid.type & qt_masks[ctx->version]);
@@ -3633,7 +3633,7 @@ static bool marshal_Rstat(struct lib9p_ctx *ctx, struct lib9p_msg_Rstat *val, st
}
static bool marshal_Twstat(struct lib9p_ctx *ctx, struct lib9p_msg_Twstat *val, struct _marshal_ret *ret) {
- uint32_t needed_size = 62 + val->stat.name.len + val->stat.owner_uname.len + val->stat.owner_gname.len + val->stat.last_modifier_uname.len;
+ uint32_t needed_size = (uint32_t)(62 + val->stat.name.len + val->stat.owner_uname.len + val->stat.owner_gname.len + val->stat.last_modifier_uname.len);
#if CONFIG_9P_ENABLE_9P2000_u
if is_ver(ctx, 9P2000_u) {
needed_size += 14 + val->stat.extension.len;
@@ -3647,21 +3647,21 @@ static bool marshal_Twstat(struct lib9p_ctx *ctx, struct lib9p_msg_Twstat *val,
return true;
}
uint32_t offsetof_end = needed_size;
- uint32_t offsetof_size = 0;
- uint32_t offsetof_stat = 13;
- MARSHAL_U32LE(ctx, offsetof_end - offsetof_size);
- MARSHAL_U8LE(ctx, 126);
+ uint32_t offsetof_size = (uint32_t)(0);
+ uint32_t offsetof_stat = (uint32_t)(13);
+ MARSHAL_U32LE(ctx, (uint32_t)(offsetof_end - offsetof_size));
+ MARSHAL_U8LE(ctx, (uint8_t)(126));
MARSHAL_U16LE(ctx, val->tag);
MARSHAL_U32LE(ctx, val->fid);
- MARSHAL_U16LE(ctx, offsetof_end - offsetof_stat);
- uint32_t offsetof_stat_end = 49 + val->stat.name.len + val->stat.owner_uname.len + val->stat.owner_gname.len + val->stat.last_modifier_uname.len;
+ MARSHAL_U16LE(ctx, (uint16_t)(offsetof_end - offsetof_stat));
+ uint32_t offsetof_stat_end = (uint32_t)(49 + val->stat.name.len + val->stat.owner_uname.len + val->stat.owner_gname.len + val->stat.last_modifier_uname.len);
#if CONFIG_9P_ENABLE_9P2000_u
if is_ver(ctx, 9P2000_u) {
offsetof_stat_end += 14 + val->stat.extension.len;
}
#endif /* CONFIG_9P_ENABLE_9P2000_u */
- uint32_t offsetof_stat_fstype = 2;
- MARSHAL_U16LE(ctx, offsetof_stat_end - offsetof_stat_fstype);
+ uint32_t offsetof_stat_fstype = (uint32_t)(2);
+ MARSHAL_U16LE(ctx, (uint16_t)(offsetof_stat_end - offsetof_stat_fstype));
MARSHAL_U16LE(ctx, val->stat.fstype);
MARSHAL_U32LE(ctx, val->stat.fsdev);
MARSHAL_U8LE(ctx, val->stat.qid.type & qt_masks[ctx->version]);
@@ -3692,7 +3692,7 @@ static bool marshal_Twstat(struct lib9p_ctx *ctx, struct lib9p_msg_Twstat *val,
}
static bool marshal_Rwstat(struct lib9p_ctx *ctx, struct lib9p_msg_Rwstat *val, struct _marshal_ret *ret) {
- uint32_t needed_size = 7;
+ uint32_t needed_size = (uint32_t)(7);
if (needed_size > ctx->max_msg_size) {
lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")",
"Rwstat",
@@ -3701,9 +3701,9 @@ static bool marshal_Rwstat(struct lib9p_ctx *ctx, struct lib9p_msg_Rwstat *val,
return true;
}
uint32_t offsetof_end = needed_size;
- uint32_t offsetof_size = 0;
- MARSHAL_U32LE(ctx, offsetof_end - offsetof_size);
- MARSHAL_U8LE(ctx, 127);
+ uint32_t offsetof_size = (uint32_t)(0);
+ MARSHAL_U32LE(ctx, (uint32_t)(offsetof_end - offsetof_size));
+ MARSHAL_U8LE(ctx, (uint8_t)(127));
MARSHAL_U16LE(ctx, val->tag);
return false;
}
@@ -3711,7 +3711,7 @@ static bool marshal_Rwstat(struct lib9p_ctx *ctx, struct lib9p_msg_Rwstat *val,
#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_p9p || CONFIG_9P_ENABLE_9P2000_u */
#if CONFIG_9P_ENABLE_9P2000_p9p
static bool marshal_Topenfd(struct lib9p_ctx *ctx, struct lib9p_msg_Topenfd *val, struct _marshal_ret *ret) {
- uint32_t needed_size = 12;
+ uint32_t needed_size = (uint32_t)(12);
if (needed_size > ctx->max_msg_size) {
lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")",
"Topenfd",
@@ -3720,9 +3720,9 @@ static bool marshal_Topenfd(struct lib9p_ctx *ctx, struct lib9p_msg_Topenfd *val
return true;
}
uint32_t offsetof_end = needed_size;
- uint32_t offsetof_size = 0;
- MARSHAL_U32LE(ctx, offsetof_end - offsetof_size);
- MARSHAL_U8LE(ctx, 98);
+ uint32_t offsetof_size = (uint32_t)(0);
+ MARSHAL_U32LE(ctx, (uint32_t)(offsetof_end - offsetof_size));
+ MARSHAL_U8LE(ctx, (uint8_t)(98));
MARSHAL_U16LE(ctx, val->tag);
MARSHAL_U32LE(ctx, val->fid);
MARSHAL_U8LE(ctx, val->mode & o_masks[ctx->version]);
@@ -3730,7 +3730,7 @@ static bool marshal_Topenfd(struct lib9p_ctx *ctx, struct lib9p_msg_Topenfd *val
}
static bool marshal_Ropenfd(struct lib9p_ctx *ctx, struct lib9p_msg_Ropenfd *val, struct _marshal_ret *ret) {
- uint32_t needed_size = 28;
+ uint32_t needed_size = (uint32_t)(28);
if (needed_size > ctx->max_msg_size) {
lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")",
"Ropenfd",
@@ -3739,9 +3739,9 @@ static bool marshal_Ropenfd(struct lib9p_ctx *ctx, struct lib9p_msg_Ropenfd *val
return true;
}
uint32_t offsetof_end = needed_size;
- uint32_t offsetof_size = 0;
- MARSHAL_U32LE(ctx, offsetof_end - offsetof_size);
- MARSHAL_U8LE(ctx, 99);
+ uint32_t offsetof_size = (uint32_t)(0);
+ MARSHAL_U32LE(ctx, (uint32_t)(offsetof_end - offsetof_size));
+ MARSHAL_U8LE(ctx, (uint8_t)(99));
MARSHAL_U16LE(ctx, val->tag);
MARSHAL_U8LE(ctx, val->qid.type & qt_masks[ctx->version]);
MARSHAL_U32LE(ctx, val->qid.vers);
@@ -3754,7 +3754,7 @@ static bool marshal_Ropenfd(struct lib9p_ctx *ctx, struct lib9p_msg_Ropenfd *val
#endif /* CONFIG_9P_ENABLE_9P2000_p9p */
#if CONFIG_9P_ENABLE_9P2000_L
static bool marshal_Rlerror(struct lib9p_ctx *ctx, struct lib9p_msg_Rlerror *val, struct _marshal_ret *ret) {
- uint32_t needed_size = 11;
+ uint32_t needed_size = (uint32_t)(11);
if (needed_size > ctx->max_msg_size) {
lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")",
"Rlerror",
@@ -3763,16 +3763,16 @@ static bool marshal_Rlerror(struct lib9p_ctx *ctx, struct lib9p_msg_Rlerror *val
return true;
}
uint32_t offsetof_end = needed_size;
- uint32_t offsetof_size = 0;
- MARSHAL_U32LE(ctx, offsetof_end - offsetof_size);
- MARSHAL_U8LE(ctx, 7);
+ uint32_t offsetof_size = (uint32_t)(0);
+ MARSHAL_U32LE(ctx, (uint32_t)(offsetof_end - offsetof_size));
+ MARSHAL_U8LE(ctx, (uint8_t)(7));
MARSHAL_U16LE(ctx, val->tag);
MARSHAL_U32LE(ctx, val->errnum);
return false;
}
static bool marshal_Tstatfs(struct lib9p_ctx *ctx, struct lib9p_msg_Tstatfs *val, struct _marshal_ret *ret) {
- uint32_t needed_size = 11;
+ uint32_t needed_size = (uint32_t)(11);
if (needed_size > ctx->max_msg_size) {
lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")",
"Tstatfs",
@@ -3781,16 +3781,16 @@ static bool marshal_Tstatfs(struct lib9p_ctx *ctx, struct lib9p_msg_Tstatfs *val
return true;
}
uint32_t offsetof_end = needed_size;
- uint32_t offsetof_size = 0;
- MARSHAL_U32LE(ctx, offsetof_end - offsetof_size);
- MARSHAL_U8LE(ctx, 8);
+ uint32_t offsetof_size = (uint32_t)(0);
+ MARSHAL_U32LE(ctx, (uint32_t)(offsetof_end - offsetof_size));
+ MARSHAL_U8LE(ctx, (uint8_t)(8));
MARSHAL_U16LE(ctx, val->tag);
MARSHAL_U32LE(ctx, val->fid);
return false;
}
static bool marshal_Rstatfs(struct lib9p_ctx *ctx, struct lib9p_msg_Rstatfs *val, struct _marshal_ret *ret) {
- uint32_t needed_size = 67;
+ uint32_t needed_size = (uint32_t)(67);
if (needed_size > ctx->max_msg_size) {
lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")",
"Rstatfs",
@@ -3799,9 +3799,9 @@ static bool marshal_Rstatfs(struct lib9p_ctx *ctx, struct lib9p_msg_Rstatfs *val
return true;
}
uint32_t offsetof_end = needed_size;
- uint32_t offsetof_size = 0;
- MARSHAL_U32LE(ctx, offsetof_end - offsetof_size);
- MARSHAL_U8LE(ctx, 9);
+ uint32_t offsetof_size = (uint32_t)(0);
+ MARSHAL_U32LE(ctx, (uint32_t)(offsetof_end - offsetof_size));
+ MARSHAL_U8LE(ctx, (uint8_t)(9));
MARSHAL_U16LE(ctx, val->tag);
MARSHAL_U32LE(ctx, val->type);
MARSHAL_U32LE(ctx, val->bsize);
@@ -3816,7 +3816,7 @@ static bool marshal_Rstatfs(struct lib9p_ctx *ctx, struct lib9p_msg_Rstatfs *val
}
static bool marshal_Tlopen(struct lib9p_ctx *ctx, struct lib9p_msg_Tlopen *val, struct _marshal_ret *ret) {
- uint32_t needed_size = 15;
+ uint32_t needed_size = (uint32_t)(15);
if (needed_size > ctx->max_msg_size) {
lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")",
"Tlopen",
@@ -3825,9 +3825,9 @@ static bool marshal_Tlopen(struct lib9p_ctx *ctx, struct lib9p_msg_Tlopen *val,
return true;
}
uint32_t offsetof_end = needed_size;
- uint32_t offsetof_size = 0;
- MARSHAL_U32LE(ctx, offsetof_end - offsetof_size);
- MARSHAL_U8LE(ctx, 12);
+ uint32_t offsetof_size = (uint32_t)(0);
+ MARSHAL_U32LE(ctx, (uint32_t)(offsetof_end - offsetof_size));
+ MARSHAL_U8LE(ctx, (uint8_t)(12));
MARSHAL_U16LE(ctx, val->tag);
MARSHAL_U32LE(ctx, val->fid);
MARSHAL_U32LE(ctx, val->flags & lo_masks[ctx->version]);
@@ -3835,7 +3835,7 @@ static bool marshal_Tlopen(struct lib9p_ctx *ctx, struct lib9p_msg_Tlopen *val,
}
static bool marshal_Rlopen(struct lib9p_ctx *ctx, struct lib9p_msg_Rlopen *val, struct _marshal_ret *ret) {
- uint32_t needed_size = 24;
+ uint32_t needed_size = (uint32_t)(24);
if (needed_size > ctx->max_msg_size) {
lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")",
"Rlopen",
@@ -3844,9 +3844,9 @@ static bool marshal_Rlopen(struct lib9p_ctx *ctx, struct lib9p_msg_Rlopen *val,
return true;
}
uint32_t offsetof_end = needed_size;
- uint32_t offsetof_size = 0;
- MARSHAL_U32LE(ctx, offsetof_end - offsetof_size);
- MARSHAL_U8LE(ctx, 13);
+ uint32_t offsetof_size = (uint32_t)(0);
+ MARSHAL_U32LE(ctx, (uint32_t)(offsetof_end - offsetof_size));
+ MARSHAL_U8LE(ctx, (uint8_t)(13));
MARSHAL_U16LE(ctx, val->tag);
MARSHAL_U8LE(ctx, val->qid.type & qt_masks[ctx->version]);
MARSHAL_U32LE(ctx, val->qid.vers);
@@ -3856,7 +3856,7 @@ static bool marshal_Rlopen(struct lib9p_ctx *ctx, struct lib9p_msg_Rlopen *val,
}
static bool marshal_Tlcreate(struct lib9p_ctx *ctx, struct lib9p_msg_Tlcreate *val, struct _marshal_ret *ret) {
- uint32_t needed_size = 25 + val->name.len;
+ uint32_t needed_size = (uint32_t)(25 + val->name.len);
if (needed_size > ctx->max_msg_size) {
lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")",
"Tlcreate",
@@ -3865,9 +3865,9 @@ static bool marshal_Tlcreate(struct lib9p_ctx *ctx, struct lib9p_msg_Tlcreate *v
return true;
}
uint32_t offsetof_end = needed_size;
- uint32_t offsetof_size = 0;
- MARSHAL_U32LE(ctx, offsetof_end - offsetof_size);
- MARSHAL_U8LE(ctx, 14);
+ uint32_t offsetof_size = (uint32_t)(0);
+ MARSHAL_U32LE(ctx, (uint32_t)(offsetof_end - offsetof_size));
+ MARSHAL_U8LE(ctx, (uint8_t)(14));
MARSHAL_U16LE(ctx, val->tag);
MARSHAL_U32LE(ctx, val->fid);
MARSHAL_U16LE(ctx, val->name.len);
@@ -3879,7 +3879,7 @@ static bool marshal_Tlcreate(struct lib9p_ctx *ctx, struct lib9p_msg_Tlcreate *v
}
static bool marshal_Rlcreate(struct lib9p_ctx *ctx, struct lib9p_msg_Rlcreate *val, struct _marshal_ret *ret) {
- uint32_t needed_size = 24;
+ uint32_t needed_size = (uint32_t)(24);
if (needed_size > ctx->max_msg_size) {
lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")",
"Rlcreate",
@@ -3888,9 +3888,9 @@ static bool marshal_Rlcreate(struct lib9p_ctx *ctx, struct lib9p_msg_Rlcreate *v
return true;
}
uint32_t offsetof_end = needed_size;
- uint32_t offsetof_size = 0;
- MARSHAL_U32LE(ctx, offsetof_end - offsetof_size);
- MARSHAL_U8LE(ctx, 15);
+ uint32_t offsetof_size = (uint32_t)(0);
+ MARSHAL_U32LE(ctx, (uint32_t)(offsetof_end - offsetof_size));
+ MARSHAL_U8LE(ctx, (uint8_t)(15));
MARSHAL_U16LE(ctx, val->tag);
MARSHAL_U8LE(ctx, val->qid.type & qt_masks[ctx->version]);
MARSHAL_U32LE(ctx, val->qid.vers);
@@ -3900,7 +3900,7 @@ static bool marshal_Rlcreate(struct lib9p_ctx *ctx, struct lib9p_msg_Rlcreate *v
}
static bool marshal_Tsymlink(struct lib9p_ctx *ctx, struct lib9p_msg_Tsymlink *val, struct _marshal_ret *ret) {
- uint32_t needed_size = 19 + val->name.len + val->symtgt.len;
+ uint32_t needed_size = (uint32_t)(19 + val->name.len + val->symtgt.len);
if (needed_size > ctx->max_msg_size) {
lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")",
"Tsymlink",
@@ -3909,9 +3909,9 @@ static bool marshal_Tsymlink(struct lib9p_ctx *ctx, struct lib9p_msg_Tsymlink *v
return true;
}
uint32_t offsetof_end = needed_size;
- uint32_t offsetof_size = 0;
- MARSHAL_U32LE(ctx, offsetof_end - offsetof_size);
- MARSHAL_U8LE(ctx, 16);
+ uint32_t offsetof_size = (uint32_t)(0);
+ MARSHAL_U32LE(ctx, (uint32_t)(offsetof_end - offsetof_size));
+ MARSHAL_U8LE(ctx, (uint8_t)(16));
MARSHAL_U16LE(ctx, val->tag);
MARSHAL_U32LE(ctx, val->fid);
MARSHAL_U16LE(ctx, val->name.len);
@@ -3923,7 +3923,7 @@ static bool marshal_Tsymlink(struct lib9p_ctx *ctx, struct lib9p_msg_Tsymlink *v
}
static bool marshal_Rsymlink(struct lib9p_ctx *ctx, struct lib9p_msg_Rsymlink *val, struct _marshal_ret *ret) {
- uint32_t needed_size = 20;
+ uint32_t needed_size = (uint32_t)(20);
if (needed_size > ctx->max_msg_size) {
lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")",
"Rsymlink",
@@ -3932,9 +3932,9 @@ static bool marshal_Rsymlink(struct lib9p_ctx *ctx, struct lib9p_msg_Rsymlink *v
return true;
}
uint32_t offsetof_end = needed_size;
- uint32_t offsetof_size = 0;
- MARSHAL_U32LE(ctx, offsetof_end - offsetof_size);
- MARSHAL_U8LE(ctx, 17);
+ uint32_t offsetof_size = (uint32_t)(0);
+ MARSHAL_U32LE(ctx, (uint32_t)(offsetof_end - offsetof_size));
+ MARSHAL_U8LE(ctx, (uint8_t)(17));
MARSHAL_U16LE(ctx, val->tag);
MARSHAL_U8LE(ctx, val->qid.type & qt_masks[ctx->version]);
MARSHAL_U32LE(ctx, val->qid.vers);
@@ -3943,7 +3943,7 @@ static bool marshal_Rsymlink(struct lib9p_ctx *ctx, struct lib9p_msg_Rsymlink *v
}
static bool marshal_Tmknod(struct lib9p_ctx *ctx, struct lib9p_msg_Tmknod *val, struct _marshal_ret *ret) {
- uint32_t needed_size = 29 + val->name.len;
+ uint32_t needed_size = (uint32_t)(29 + val->name.len);
if (needed_size > ctx->max_msg_size) {
lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")",
"Tmknod",
@@ -3952,9 +3952,9 @@ static bool marshal_Tmknod(struct lib9p_ctx *ctx, struct lib9p_msg_Tmknod *val,
return true;
}
uint32_t offsetof_end = needed_size;
- uint32_t offsetof_size = 0;
- MARSHAL_U32LE(ctx, offsetof_end - offsetof_size);
- MARSHAL_U8LE(ctx, 18);
+ uint32_t offsetof_size = (uint32_t)(0);
+ MARSHAL_U32LE(ctx, (uint32_t)(offsetof_end - offsetof_size));
+ MARSHAL_U8LE(ctx, (uint8_t)(18));
MARSHAL_U16LE(ctx, val->tag);
MARSHAL_U32LE(ctx, val->dfid);
MARSHAL_U16LE(ctx, val->name.len);
@@ -3967,7 +3967,7 @@ static bool marshal_Tmknod(struct lib9p_ctx *ctx, struct lib9p_msg_Tmknod *val,
}
static bool marshal_Rmknod(struct lib9p_ctx *ctx, struct lib9p_msg_Rmknod *val, struct _marshal_ret *ret) {
- uint32_t needed_size = 20;
+ uint32_t needed_size = (uint32_t)(20);
if (needed_size > ctx->max_msg_size) {
lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")",
"Rmknod",
@@ -3976,9 +3976,9 @@ static bool marshal_Rmknod(struct lib9p_ctx *ctx, struct lib9p_msg_Rmknod *val,
return true;
}
uint32_t offsetof_end = needed_size;
- uint32_t offsetof_size = 0;
- MARSHAL_U32LE(ctx, offsetof_end - offsetof_size);
- MARSHAL_U8LE(ctx, 19);
+ uint32_t offsetof_size = (uint32_t)(0);
+ MARSHAL_U32LE(ctx, (uint32_t)(offsetof_end - offsetof_size));
+ MARSHAL_U8LE(ctx, (uint8_t)(19));
MARSHAL_U16LE(ctx, val->tag);
MARSHAL_U8LE(ctx, val->qid.type & qt_masks[ctx->version]);
MARSHAL_U32LE(ctx, val->qid.vers);
@@ -3987,7 +3987,7 @@ static bool marshal_Rmknod(struct lib9p_ctx *ctx, struct lib9p_msg_Rmknod *val,
}
static bool marshal_Trename(struct lib9p_ctx *ctx, struct lib9p_msg_Trename *val, struct _marshal_ret *ret) {
- uint32_t needed_size = 17 + val->name.len;
+ uint32_t needed_size = (uint32_t)(17 + val->name.len);
if (needed_size > ctx->max_msg_size) {
lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")",
"Trename",
@@ -3996,9 +3996,9 @@ static bool marshal_Trename(struct lib9p_ctx *ctx, struct lib9p_msg_Trename *val
return true;
}
uint32_t offsetof_end = needed_size;
- uint32_t offsetof_size = 0;
- MARSHAL_U32LE(ctx, offsetof_end - offsetof_size);
- MARSHAL_U8LE(ctx, 20);
+ uint32_t offsetof_size = (uint32_t)(0);
+ MARSHAL_U32LE(ctx, (uint32_t)(offsetof_end - offsetof_size));
+ MARSHAL_U8LE(ctx, (uint8_t)(20));
MARSHAL_U16LE(ctx, val->tag);
MARSHAL_U32LE(ctx, val->fid);
MARSHAL_U32LE(ctx, val->dfid);
@@ -4008,7 +4008,7 @@ static bool marshal_Trename(struct lib9p_ctx *ctx, struct lib9p_msg_Trename *val
}
static bool marshal_Rrename(struct lib9p_ctx *ctx, struct lib9p_msg_Rrename *val, struct _marshal_ret *ret) {
- uint32_t needed_size = 7;
+ uint32_t needed_size = (uint32_t)(7);
if (needed_size > ctx->max_msg_size) {
lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")",
"Rrename",
@@ -4017,15 +4017,15 @@ static bool marshal_Rrename(struct lib9p_ctx *ctx, struct lib9p_msg_Rrename *val
return true;
}
uint32_t offsetof_end = needed_size;
- uint32_t offsetof_size = 0;
- MARSHAL_U32LE(ctx, offsetof_end - offsetof_size);
- MARSHAL_U8LE(ctx, 21);
+ uint32_t offsetof_size = (uint32_t)(0);
+ MARSHAL_U32LE(ctx, (uint32_t)(offsetof_end - offsetof_size));
+ MARSHAL_U8LE(ctx, (uint8_t)(21));
MARSHAL_U16LE(ctx, val->tag);
return false;
}
static bool marshal_Treadlink(struct lib9p_ctx *ctx, struct lib9p_msg_Treadlink *val, struct _marshal_ret *ret) {
- uint32_t needed_size = 11;
+ uint32_t needed_size = (uint32_t)(11);
if (needed_size > ctx->max_msg_size) {
lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")",
"Treadlink",
@@ -4034,16 +4034,16 @@ static bool marshal_Treadlink(struct lib9p_ctx *ctx, struct lib9p_msg_Treadlink
return true;
}
uint32_t offsetof_end = needed_size;
- uint32_t offsetof_size = 0;
- MARSHAL_U32LE(ctx, offsetof_end - offsetof_size);
- MARSHAL_U8LE(ctx, 22);
+ uint32_t offsetof_size = (uint32_t)(0);
+ MARSHAL_U32LE(ctx, (uint32_t)(offsetof_end - offsetof_size));
+ MARSHAL_U8LE(ctx, (uint8_t)(22));
MARSHAL_U16LE(ctx, val->tag);
MARSHAL_U32LE(ctx, val->fid);
return false;
}
static bool marshal_Rreadlink(struct lib9p_ctx *ctx, struct lib9p_msg_Rreadlink *val, struct _marshal_ret *ret) {
- uint32_t needed_size = 9 + val->target.len;
+ uint32_t needed_size = (uint32_t)(9 + val->target.len);
if (needed_size > ctx->max_msg_size) {
lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")",
"Rreadlink",
@@ -4052,9 +4052,9 @@ static bool marshal_Rreadlink(struct lib9p_ctx *ctx, struct lib9p_msg_Rreadlink
return true;
}
uint32_t offsetof_end = needed_size;
- uint32_t offsetof_size = 0;
- MARSHAL_U32LE(ctx, offsetof_end - offsetof_size);
- MARSHAL_U8LE(ctx, 23);
+ uint32_t offsetof_size = (uint32_t)(0);
+ MARSHAL_U32LE(ctx, (uint32_t)(offsetof_end - offsetof_size));
+ MARSHAL_U8LE(ctx, (uint8_t)(23));
MARSHAL_U16LE(ctx, val->tag);
MARSHAL_U16LE(ctx, val->target.len);
MARSHAL_BYTES_ZEROCOPY(ctx, val->target.utf8, val->target.len);
@@ -4062,7 +4062,7 @@ static bool marshal_Rreadlink(struct lib9p_ctx *ctx, struct lib9p_msg_Rreadlink
}
static bool marshal_Tgetattr(struct lib9p_ctx *ctx, struct lib9p_msg_Tgetattr *val, struct _marshal_ret *ret) {
- uint32_t needed_size = 19;
+ uint32_t needed_size = (uint32_t)(19);
if (needed_size > ctx->max_msg_size) {
lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")",
"Tgetattr",
@@ -4071,9 +4071,9 @@ static bool marshal_Tgetattr(struct lib9p_ctx *ctx, struct lib9p_msg_Tgetattr *v
return true;
}
uint32_t offsetof_end = needed_size;
- uint32_t offsetof_size = 0;
- MARSHAL_U32LE(ctx, offsetof_end - offsetof_size);
- MARSHAL_U8LE(ctx, 24);
+ uint32_t offsetof_size = (uint32_t)(0);
+ MARSHAL_U32LE(ctx, (uint32_t)(offsetof_end - offsetof_size));
+ MARSHAL_U8LE(ctx, (uint8_t)(24));
MARSHAL_U16LE(ctx, val->tag);
MARSHAL_U32LE(ctx, val->fid);
MARSHAL_U64LE(ctx, val->request_mask & getattr_masks[ctx->version]);
@@ -4081,7 +4081,7 @@ static bool marshal_Tgetattr(struct lib9p_ctx *ctx, struct lib9p_msg_Tgetattr *v
}
static bool marshal_Rgetattr(struct lib9p_ctx *ctx, struct lib9p_msg_Rgetattr *val, struct _marshal_ret *ret) {
- uint32_t needed_size = 160;
+ uint32_t needed_size = (uint32_t)(160);
if (needed_size > ctx->max_msg_size) {
lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")",
"Rgetattr",
@@ -4090,9 +4090,9 @@ static bool marshal_Rgetattr(struct lib9p_ctx *ctx, struct lib9p_msg_Rgetattr *v
return true;
}
uint32_t offsetof_end = needed_size;
- uint32_t offsetof_size = 0;
- MARSHAL_U32LE(ctx, offsetof_end - offsetof_size);
- MARSHAL_U8LE(ctx, 25);
+ uint32_t offsetof_size = (uint32_t)(0);
+ MARSHAL_U32LE(ctx, (uint32_t)(offsetof_end - offsetof_size));
+ MARSHAL_U8LE(ctx, (uint8_t)(25));
MARSHAL_U16LE(ctx, val->tag);
MARSHAL_U64LE(ctx, val->valid & getattr_masks[ctx->version]);
MARSHAL_U8LE(ctx, val->qid.type & qt_masks[ctx->version]);
@@ -4120,7 +4120,7 @@ static bool marshal_Rgetattr(struct lib9p_ctx *ctx, struct lib9p_msg_Rgetattr *v
}
static bool marshal_Tsetattr(struct lib9p_ctx *ctx, struct lib9p_msg_Tsetattr *val, struct _marshal_ret *ret) {
- uint32_t needed_size = 67;
+ uint32_t needed_size = (uint32_t)(67);
if (needed_size > ctx->max_msg_size) {
lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")",
"Tsetattr",
@@ -4129,9 +4129,9 @@ static bool marshal_Tsetattr(struct lib9p_ctx *ctx, struct lib9p_msg_Tsetattr *v
return true;
}
uint32_t offsetof_end = needed_size;
- uint32_t offsetof_size = 0;
- MARSHAL_U32LE(ctx, offsetof_end - offsetof_size);
- MARSHAL_U8LE(ctx, 26);
+ uint32_t offsetof_size = (uint32_t)(0);
+ MARSHAL_U32LE(ctx, (uint32_t)(offsetof_end - offsetof_size));
+ MARSHAL_U8LE(ctx, (uint8_t)(26));
MARSHAL_U16LE(ctx, val->tag);
MARSHAL_U32LE(ctx, val->fid);
MARSHAL_U32LE(ctx, val->valid & setattr_masks[ctx->version]);
@@ -4147,7 +4147,7 @@ static bool marshal_Tsetattr(struct lib9p_ctx *ctx, struct lib9p_msg_Tsetattr *v
}
static bool marshal_Rsetattr(struct lib9p_ctx *ctx, struct lib9p_msg_Rsetattr *val, struct _marshal_ret *ret) {
- uint32_t needed_size = 7;
+ uint32_t needed_size = (uint32_t)(7);
if (needed_size > ctx->max_msg_size) {
lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")",
"Rsetattr",
@@ -4156,15 +4156,15 @@ static bool marshal_Rsetattr(struct lib9p_ctx *ctx, struct lib9p_msg_Rsetattr *v
return true;
}
uint32_t offsetof_end = needed_size;
- uint32_t offsetof_size = 0;
- MARSHAL_U32LE(ctx, offsetof_end - offsetof_size);
- MARSHAL_U8LE(ctx, 27);
+ uint32_t offsetof_size = (uint32_t)(0);
+ MARSHAL_U32LE(ctx, (uint32_t)(offsetof_end - offsetof_size));
+ MARSHAL_U8LE(ctx, (uint8_t)(27));
MARSHAL_U16LE(ctx, val->tag);
return false;
}
static bool marshal_Txattrwalk(struct lib9p_ctx *ctx, struct lib9p_msg_Txattrwalk *val, struct _marshal_ret *ret) {
- uint32_t needed_size = 17 + val->name.len;
+ uint32_t needed_size = (uint32_t)(17 + val->name.len);
if (needed_size > ctx->max_msg_size) {
lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")",
"Txattrwalk",
@@ -4173,9 +4173,9 @@ static bool marshal_Txattrwalk(struct lib9p_ctx *ctx, struct lib9p_msg_Txattrwal
return true;
}
uint32_t offsetof_end = needed_size;
- uint32_t offsetof_size = 0;
- MARSHAL_U32LE(ctx, offsetof_end - offsetof_size);
- MARSHAL_U8LE(ctx, 30);
+ uint32_t offsetof_size = (uint32_t)(0);
+ MARSHAL_U32LE(ctx, (uint32_t)(offsetof_end - offsetof_size));
+ MARSHAL_U8LE(ctx, (uint8_t)(30));
MARSHAL_U16LE(ctx, val->tag);
MARSHAL_U32LE(ctx, val->fid);
MARSHAL_U32LE(ctx, val->newfid);
@@ -4185,7 +4185,7 @@ static bool marshal_Txattrwalk(struct lib9p_ctx *ctx, struct lib9p_msg_Txattrwal
}
static bool marshal_Rxattrwalk(struct lib9p_ctx *ctx, struct lib9p_msg_Rxattrwalk *val, struct _marshal_ret *ret) {
- uint32_t needed_size = 15;
+ uint32_t needed_size = (uint32_t)(15);
if (needed_size > ctx->max_msg_size) {
lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")",
"Rxattrwalk",
@@ -4194,16 +4194,16 @@ static bool marshal_Rxattrwalk(struct lib9p_ctx *ctx, struct lib9p_msg_Rxattrwal
return true;
}
uint32_t offsetof_end = needed_size;
- uint32_t offsetof_size = 0;
- MARSHAL_U32LE(ctx, offsetof_end - offsetof_size);
- MARSHAL_U8LE(ctx, 31);
+ uint32_t offsetof_size = (uint32_t)(0);
+ MARSHAL_U32LE(ctx, (uint32_t)(offsetof_end - offsetof_size));
+ MARSHAL_U8LE(ctx, (uint8_t)(31));
MARSHAL_U16LE(ctx, val->tag);
MARSHAL_U64LE(ctx, val->attr_size);
return false;
}
static bool marshal_Txattrcreate(struct lib9p_ctx *ctx, struct lib9p_msg_Txattrcreate *val, struct _marshal_ret *ret) {
- uint32_t needed_size = 25 + val->name.len;
+ uint32_t needed_size = (uint32_t)(25 + val->name.len);
if (needed_size > ctx->max_msg_size) {
lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")",
"Txattrcreate",
@@ -4212,9 +4212,9 @@ static bool marshal_Txattrcreate(struct lib9p_ctx *ctx, struct lib9p_msg_Txattrc
return true;
}
uint32_t offsetof_end = needed_size;
- uint32_t offsetof_size = 0;
- MARSHAL_U32LE(ctx, offsetof_end - offsetof_size);
- MARSHAL_U8LE(ctx, 32);
+ uint32_t offsetof_size = (uint32_t)(0);
+ MARSHAL_U32LE(ctx, (uint32_t)(offsetof_end - offsetof_size));
+ MARSHAL_U8LE(ctx, (uint8_t)(32));
MARSHAL_U16LE(ctx, val->tag);
MARSHAL_U32LE(ctx, val->fid);
MARSHAL_U16LE(ctx, val->name.len);
@@ -4225,7 +4225,7 @@ static bool marshal_Txattrcreate(struct lib9p_ctx *ctx, struct lib9p_msg_Txattrc
}
static bool marshal_Rxattrcreate(struct lib9p_ctx *ctx, struct lib9p_msg_Rxattrcreate *val, struct _marshal_ret *ret) {
- uint32_t needed_size = 7;
+ uint32_t needed_size = (uint32_t)(7);
if (needed_size > ctx->max_msg_size) {
lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")",
"Rxattrcreate",
@@ -4234,15 +4234,15 @@ static bool marshal_Rxattrcreate(struct lib9p_ctx *ctx, struct lib9p_msg_Rxattrc
return true;
}
uint32_t offsetof_end = needed_size;
- uint32_t offsetof_size = 0;
- MARSHAL_U32LE(ctx, offsetof_end - offsetof_size);
- MARSHAL_U8LE(ctx, 33);
+ uint32_t offsetof_size = (uint32_t)(0);
+ MARSHAL_U32LE(ctx, (uint32_t)(offsetof_end - offsetof_size));
+ MARSHAL_U8LE(ctx, (uint8_t)(33));
MARSHAL_U16LE(ctx, val->tag);
return false;
}
static bool marshal_Treaddir(struct lib9p_ctx *ctx, struct lib9p_msg_Treaddir *val, struct _marshal_ret *ret) {
- uint32_t needed_size = 23;
+ uint32_t needed_size = (uint32_t)(23);
if (needed_size > ctx->max_msg_size) {
lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")",
"Treaddir",
@@ -4251,9 +4251,9 @@ static bool marshal_Treaddir(struct lib9p_ctx *ctx, struct lib9p_msg_Treaddir *v
return true;
}
uint32_t offsetof_end = needed_size;
- uint32_t offsetof_size = 0;
- MARSHAL_U32LE(ctx, offsetof_end - offsetof_size);
- MARSHAL_U8LE(ctx, 40);
+ uint32_t offsetof_size = (uint32_t)(0);
+ MARSHAL_U32LE(ctx, (uint32_t)(offsetof_end - offsetof_size));
+ MARSHAL_U8LE(ctx, (uint8_t)(40));
MARSHAL_U16LE(ctx, val->tag);
MARSHAL_U32LE(ctx, val->fid);
MARSHAL_U64LE(ctx, val->offset);
@@ -4262,7 +4262,7 @@ static bool marshal_Treaddir(struct lib9p_ctx *ctx, struct lib9p_msg_Treaddir *v
}
static bool marshal_Rreaddir(struct lib9p_ctx *ctx, struct lib9p_msg_Rreaddir *val, struct _marshal_ret *ret) {
- uint64_t needed_size = 11 + val->count;
+ uint64_t needed_size = (uint64_t)(11 + val->count);
if (needed_size > (uint64_t)(ctx->max_msg_size)) {
lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu64" > %"PRIu32")",
"Rreaddir",
@@ -4271,9 +4271,9 @@ static bool marshal_Rreaddir(struct lib9p_ctx *ctx, struct lib9p_msg_Rreaddir *v
return true;
}
uint32_t offsetof_end = (uint32_t)needed_size;
- uint32_t offsetof_size = 0;
- MARSHAL_U32LE(ctx, offsetof_end - offsetof_size);
- MARSHAL_U8LE(ctx, 41);
+ uint32_t offsetof_size = (uint32_t)(0);
+ MARSHAL_U32LE(ctx, (uint32_t)(offsetof_end - offsetof_size));
+ MARSHAL_U8LE(ctx, (uint8_t)(41));
MARSHAL_U16LE(ctx, val->tag);
MARSHAL_U32LE(ctx, val->count);
MARSHAL_BYTES_ZEROCOPY(ctx, val->data, val->count);
@@ -4281,7 +4281,7 @@ static bool marshal_Rreaddir(struct lib9p_ctx *ctx, struct lib9p_msg_Rreaddir *v
}
static bool marshal_Tfsync(struct lib9p_ctx *ctx, struct lib9p_msg_Tfsync *val, struct _marshal_ret *ret) {
- uint32_t needed_size = 15;
+ uint32_t needed_size = (uint32_t)(15);
if (needed_size > ctx->max_msg_size) {
lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")",
"Tfsync",
@@ -4290,9 +4290,9 @@ static bool marshal_Tfsync(struct lib9p_ctx *ctx, struct lib9p_msg_Tfsync *val,
return true;
}
uint32_t offsetof_end = needed_size;
- uint32_t offsetof_size = 0;
- MARSHAL_U32LE(ctx, offsetof_end - offsetof_size);
- MARSHAL_U8LE(ctx, 50);
+ uint32_t offsetof_size = (uint32_t)(0);
+ MARSHAL_U32LE(ctx, (uint32_t)(offsetof_end - offsetof_size));
+ MARSHAL_U8LE(ctx, (uint8_t)(50));
MARSHAL_U16LE(ctx, val->tag);
MARSHAL_U32LE(ctx, val->fid);
MARSHAL_U32LE(ctx, val->datasync);
@@ -4300,7 +4300,7 @@ static bool marshal_Tfsync(struct lib9p_ctx *ctx, struct lib9p_msg_Tfsync *val,
}
static bool marshal_Rfsync(struct lib9p_ctx *ctx, struct lib9p_msg_Rfsync *val, struct _marshal_ret *ret) {
- uint32_t needed_size = 7;
+ uint32_t needed_size = (uint32_t)(7);
if (needed_size > ctx->max_msg_size) {
lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")",
"Rfsync",
@@ -4309,15 +4309,15 @@ static bool marshal_Rfsync(struct lib9p_ctx *ctx, struct lib9p_msg_Rfsync *val,
return true;
}
uint32_t offsetof_end = needed_size;
- uint32_t offsetof_size = 0;
- MARSHAL_U32LE(ctx, offsetof_end - offsetof_size);
- MARSHAL_U8LE(ctx, 51);
+ uint32_t offsetof_size = (uint32_t)(0);
+ MARSHAL_U32LE(ctx, (uint32_t)(offsetof_end - offsetof_size));
+ MARSHAL_U8LE(ctx, (uint8_t)(51));
MARSHAL_U16LE(ctx, val->tag);
return false;
}
static bool marshal_Tlock(struct lib9p_ctx *ctx, struct lib9p_msg_Tlock *val, struct _marshal_ret *ret) {
- uint32_t needed_size = 38 + val->client_id.len;
+ uint32_t needed_size = (uint32_t)(38 + val->client_id.len);
if (needed_size > ctx->max_msg_size) {
lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")",
"Tlock",
@@ -4326,9 +4326,9 @@ static bool marshal_Tlock(struct lib9p_ctx *ctx, struct lib9p_msg_Tlock *val, st
return true;
}
uint32_t offsetof_end = needed_size;
- uint32_t offsetof_size = 0;
- MARSHAL_U32LE(ctx, offsetof_end - offsetof_size);
- MARSHAL_U8LE(ctx, 52);
+ uint32_t offsetof_size = (uint32_t)(0);
+ MARSHAL_U32LE(ctx, (uint32_t)(offsetof_end - offsetof_size));
+ MARSHAL_U8LE(ctx, (uint8_t)(52));
MARSHAL_U16LE(ctx, val->tag);
MARSHAL_U32LE(ctx, val->fid);
MARSHAL_U8LE(ctx, val->type);
@@ -4342,7 +4342,7 @@ static bool marshal_Tlock(struct lib9p_ctx *ctx, struct lib9p_msg_Tlock *val, st
}
static bool marshal_Rlock(struct lib9p_ctx *ctx, struct lib9p_msg_Rlock *val, struct _marshal_ret *ret) {
- uint32_t needed_size = 8;
+ uint32_t needed_size = (uint32_t)(8);
if (needed_size > ctx->max_msg_size) {
lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")",
"Rlock",
@@ -4351,16 +4351,16 @@ static bool marshal_Rlock(struct lib9p_ctx *ctx, struct lib9p_msg_Rlock *val, st
return true;
}
uint32_t offsetof_end = needed_size;
- uint32_t offsetof_size = 0;
- MARSHAL_U32LE(ctx, offsetof_end - offsetof_size);
- MARSHAL_U8LE(ctx, 53);
+ uint32_t offsetof_size = (uint32_t)(0);
+ MARSHAL_U32LE(ctx, (uint32_t)(offsetof_end - offsetof_size));
+ MARSHAL_U8LE(ctx, (uint8_t)(53));
MARSHAL_U16LE(ctx, val->tag);
MARSHAL_U8LE(ctx, val->status);
return false;
}
static bool marshal_Tgetlock(struct lib9p_ctx *ctx, struct lib9p_msg_Tgetlock *val, struct _marshal_ret *ret) {
- uint32_t needed_size = 34 + val->client_id.len;
+ uint32_t needed_size = (uint32_t)(34 + val->client_id.len);
if (needed_size > ctx->max_msg_size) {
lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")",
"Tgetlock",
@@ -4369,9 +4369,9 @@ static bool marshal_Tgetlock(struct lib9p_ctx *ctx, struct lib9p_msg_Tgetlock *v
return true;
}
uint32_t offsetof_end = needed_size;
- uint32_t offsetof_size = 0;
- MARSHAL_U32LE(ctx, offsetof_end - offsetof_size);
- MARSHAL_U8LE(ctx, 54);
+ uint32_t offsetof_size = (uint32_t)(0);
+ MARSHAL_U32LE(ctx, (uint32_t)(offsetof_end - offsetof_size));
+ MARSHAL_U8LE(ctx, (uint8_t)(54));
MARSHAL_U16LE(ctx, val->tag);
MARSHAL_U32LE(ctx, val->fid);
MARSHAL_U8LE(ctx, val->type);
@@ -4384,7 +4384,7 @@ static bool marshal_Tgetlock(struct lib9p_ctx *ctx, struct lib9p_msg_Tgetlock *v
}
static bool marshal_Rgetlock(struct lib9p_ctx *ctx, struct lib9p_msg_Rgetlock *val, struct _marshal_ret *ret) {
- uint32_t needed_size = 30 + val->client_id.len;
+ uint32_t needed_size = (uint32_t)(30 + val->client_id.len);
if (needed_size > ctx->max_msg_size) {
lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")",
"Rgetlock",
@@ -4393,9 +4393,9 @@ static bool marshal_Rgetlock(struct lib9p_ctx *ctx, struct lib9p_msg_Rgetlock *v
return true;
}
uint32_t offsetof_end = needed_size;
- uint32_t offsetof_size = 0;
- MARSHAL_U32LE(ctx, offsetof_end - offsetof_size);
- MARSHAL_U8LE(ctx, 55);
+ uint32_t offsetof_size = (uint32_t)(0);
+ MARSHAL_U32LE(ctx, (uint32_t)(offsetof_end - offsetof_size));
+ MARSHAL_U8LE(ctx, (uint8_t)(55));
MARSHAL_U16LE(ctx, val->tag);
MARSHAL_U8LE(ctx, val->type);
MARSHAL_U64LE(ctx, val->start);
@@ -4407,7 +4407,7 @@ static bool marshal_Rgetlock(struct lib9p_ctx *ctx, struct lib9p_msg_Rgetlock *v
}
static bool marshal_Tlink(struct lib9p_ctx *ctx, struct lib9p_msg_Tlink *val, struct _marshal_ret *ret) {
- uint32_t needed_size = 17 + val->name.len;
+ uint32_t needed_size = (uint32_t)(17 + val->name.len);
if (needed_size > ctx->max_msg_size) {
lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")",
"Tlink",
@@ -4416,9 +4416,9 @@ static bool marshal_Tlink(struct lib9p_ctx *ctx, struct lib9p_msg_Tlink *val, st
return true;
}
uint32_t offsetof_end = needed_size;
- uint32_t offsetof_size = 0;
- MARSHAL_U32LE(ctx, offsetof_end - offsetof_size);
- MARSHAL_U8LE(ctx, 70);
+ uint32_t offsetof_size = (uint32_t)(0);
+ MARSHAL_U32LE(ctx, (uint32_t)(offsetof_end - offsetof_size));
+ MARSHAL_U8LE(ctx, (uint8_t)(70));
MARSHAL_U16LE(ctx, val->tag);
MARSHAL_U32LE(ctx, val->dfid);
MARSHAL_U32LE(ctx, val->fid);
@@ -4428,7 +4428,7 @@ static bool marshal_Tlink(struct lib9p_ctx *ctx, struct lib9p_msg_Tlink *val, st
}
static bool marshal_Rlink(struct lib9p_ctx *ctx, struct lib9p_msg_Rlink *val, struct _marshal_ret *ret) {
- uint32_t needed_size = 7;
+ uint32_t needed_size = (uint32_t)(7);
if (needed_size > ctx->max_msg_size) {
lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")",
"Rlink",
@@ -4437,15 +4437,15 @@ static bool marshal_Rlink(struct lib9p_ctx *ctx, struct lib9p_msg_Rlink *val, st
return true;
}
uint32_t offsetof_end = needed_size;
- uint32_t offsetof_size = 0;
- MARSHAL_U32LE(ctx, offsetof_end - offsetof_size);
- MARSHAL_U8LE(ctx, 71);
+ uint32_t offsetof_size = (uint32_t)(0);
+ MARSHAL_U32LE(ctx, (uint32_t)(offsetof_end - offsetof_size));
+ MARSHAL_U8LE(ctx, (uint8_t)(71));
MARSHAL_U16LE(ctx, val->tag);
return false;
}
static bool marshal_Tmkdir(struct lib9p_ctx *ctx, struct lib9p_msg_Tmkdir *val, struct _marshal_ret *ret) {
- uint32_t needed_size = 21 + val->name.len;
+ uint32_t needed_size = (uint32_t)(21 + val->name.len);
if (needed_size > ctx->max_msg_size) {
lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")",
"Tmkdir",
@@ -4454,9 +4454,9 @@ static bool marshal_Tmkdir(struct lib9p_ctx *ctx, struct lib9p_msg_Tmkdir *val,
return true;
}
uint32_t offsetof_end = needed_size;
- uint32_t offsetof_size = 0;
- MARSHAL_U32LE(ctx, offsetof_end - offsetof_size);
- MARSHAL_U8LE(ctx, 72);
+ uint32_t offsetof_size = (uint32_t)(0);
+ MARSHAL_U32LE(ctx, (uint32_t)(offsetof_end - offsetof_size));
+ MARSHAL_U8LE(ctx, (uint8_t)(72));
MARSHAL_U16LE(ctx, val->tag);
MARSHAL_U32LE(ctx, val->dfid);
MARSHAL_U16LE(ctx, val->name.len);
@@ -4467,7 +4467,7 @@ static bool marshal_Tmkdir(struct lib9p_ctx *ctx, struct lib9p_msg_Tmkdir *val,
}
static bool marshal_Rmkdir(struct lib9p_ctx *ctx, struct lib9p_msg_Rmkdir *val, struct _marshal_ret *ret) {
- uint32_t needed_size = 20;
+ uint32_t needed_size = (uint32_t)(20);
if (needed_size > ctx->max_msg_size) {
lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")",
"Rmkdir",
@@ -4476,9 +4476,9 @@ static bool marshal_Rmkdir(struct lib9p_ctx *ctx, struct lib9p_msg_Rmkdir *val,
return true;
}
uint32_t offsetof_end = needed_size;
- uint32_t offsetof_size = 0;
- MARSHAL_U32LE(ctx, offsetof_end - offsetof_size);
- MARSHAL_U8LE(ctx, 73);
+ uint32_t offsetof_size = (uint32_t)(0);
+ MARSHAL_U32LE(ctx, (uint32_t)(offsetof_end - offsetof_size));
+ MARSHAL_U8LE(ctx, (uint8_t)(73));
MARSHAL_U16LE(ctx, val->tag);
MARSHAL_U8LE(ctx, val->qid.type & qt_masks[ctx->version]);
MARSHAL_U32LE(ctx, val->qid.vers);
@@ -4487,7 +4487,7 @@ static bool marshal_Rmkdir(struct lib9p_ctx *ctx, struct lib9p_msg_Rmkdir *val,
}
static bool marshal_Trenameat(struct lib9p_ctx *ctx, struct lib9p_msg_Trenameat *val, struct _marshal_ret *ret) {
- uint32_t needed_size = 19 + val->oldname.len + val->newname.len;
+ uint32_t needed_size = (uint32_t)(19 + val->oldname.len + val->newname.len);
if (needed_size > ctx->max_msg_size) {
lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")",
"Trenameat",
@@ -4496,9 +4496,9 @@ static bool marshal_Trenameat(struct lib9p_ctx *ctx, struct lib9p_msg_Trenameat
return true;
}
uint32_t offsetof_end = needed_size;
- uint32_t offsetof_size = 0;
- MARSHAL_U32LE(ctx, offsetof_end - offsetof_size);
- MARSHAL_U8LE(ctx, 74);
+ uint32_t offsetof_size = (uint32_t)(0);
+ MARSHAL_U32LE(ctx, (uint32_t)(offsetof_end - offsetof_size));
+ MARSHAL_U8LE(ctx, (uint8_t)(74));
MARSHAL_U16LE(ctx, val->tag);
MARSHAL_U32LE(ctx, val->olddirfid);
MARSHAL_U16LE(ctx, val->oldname.len);
@@ -4510,7 +4510,7 @@ static bool marshal_Trenameat(struct lib9p_ctx *ctx, struct lib9p_msg_Trenameat
}
static bool marshal_Rrenameat(struct lib9p_ctx *ctx, struct lib9p_msg_Rrenameat *val, struct _marshal_ret *ret) {
- uint32_t needed_size = 7;
+ uint32_t needed_size = (uint32_t)(7);
if (needed_size > ctx->max_msg_size) {
lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")",
"Rrenameat",
@@ -4519,15 +4519,15 @@ static bool marshal_Rrenameat(struct lib9p_ctx *ctx, struct lib9p_msg_Rrenameat
return true;
}
uint32_t offsetof_end = needed_size;
- uint32_t offsetof_size = 0;
- MARSHAL_U32LE(ctx, offsetof_end - offsetof_size);
- MARSHAL_U8LE(ctx, 75);
+ uint32_t offsetof_size = (uint32_t)(0);
+ MARSHAL_U32LE(ctx, (uint32_t)(offsetof_end - offsetof_size));
+ MARSHAL_U8LE(ctx, (uint8_t)(75));
MARSHAL_U16LE(ctx, val->tag);
return false;
}
static bool marshal_Tunlinkat(struct lib9p_ctx *ctx, struct lib9p_msg_Tunlinkat *val, struct _marshal_ret *ret) {
- uint32_t needed_size = 17 + val->name.len;
+ uint32_t needed_size = (uint32_t)(17 + val->name.len);
if (needed_size > ctx->max_msg_size) {
lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")",
"Tunlinkat",
@@ -4536,9 +4536,9 @@ static bool marshal_Tunlinkat(struct lib9p_ctx *ctx, struct lib9p_msg_Tunlinkat
return true;
}
uint32_t offsetof_end = needed_size;
- uint32_t offsetof_size = 0;
- MARSHAL_U32LE(ctx, offsetof_end - offsetof_size);
- MARSHAL_U8LE(ctx, 76);
+ uint32_t offsetof_size = (uint32_t)(0);
+ MARSHAL_U32LE(ctx, (uint32_t)(offsetof_end - offsetof_size));
+ MARSHAL_U8LE(ctx, (uint8_t)(76));
MARSHAL_U16LE(ctx, val->tag);
MARSHAL_U32LE(ctx, val->dirfd);
MARSHAL_U16LE(ctx, val->name.len);
@@ -4548,7 +4548,7 @@ static bool marshal_Tunlinkat(struct lib9p_ctx *ctx, struct lib9p_msg_Tunlinkat
}
static bool marshal_Runlinkat(struct lib9p_ctx *ctx, struct lib9p_msg_Runlinkat *val, struct _marshal_ret *ret) {
- uint32_t needed_size = 7;
+ uint32_t needed_size = (uint32_t)(7);
if (needed_size > ctx->max_msg_size) {
lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")",
"Runlinkat",
@@ -4557,9 +4557,9 @@ static bool marshal_Runlinkat(struct lib9p_ctx *ctx, struct lib9p_msg_Runlinkat
return true;
}
uint32_t offsetof_end = needed_size;
- uint32_t offsetof_size = 0;
- MARSHAL_U32LE(ctx, offsetof_end - offsetof_size);
- MARSHAL_U8LE(ctx, 77);
+ uint32_t offsetof_size = (uint32_t)(0);
+ MARSHAL_U32LE(ctx, (uint32_t)(offsetof_end - offsetof_size));
+ MARSHAL_U8LE(ctx, (uint8_t)(77));
MARSHAL_U16LE(ctx, val->tag);
return false;
}
@@ -4567,7 +4567,7 @@ static bool marshal_Runlinkat(struct lib9p_ctx *ctx, struct lib9p_msg_Runlinkat
#endif /* CONFIG_9P_ENABLE_9P2000_L */
#if CONFIG_9P_ENABLE_9P2000_e
static bool marshal_Tsession(struct lib9p_ctx *ctx, struct lib9p_msg_Tsession *val, struct _marshal_ret *ret) {
- uint32_t needed_size = 15;
+ uint32_t needed_size = (uint32_t)(15);
if (needed_size > ctx->max_msg_size) {
lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")",
"Tsession",
@@ -4576,16 +4576,16 @@ static bool marshal_Tsession(struct lib9p_ctx *ctx, struct lib9p_msg_Tsession *v
return true;
}
uint32_t offsetof_end = needed_size;
- uint32_t offsetof_size = 0;
- MARSHAL_U32LE(ctx, offsetof_end - offsetof_size);
- MARSHAL_U8LE(ctx, 150);
+ uint32_t offsetof_size = (uint32_t)(0);
+ MARSHAL_U32LE(ctx, (uint32_t)(offsetof_end - offsetof_size));
+ MARSHAL_U8LE(ctx, (uint8_t)(150));
MARSHAL_U16LE(ctx, val->tag);
MARSHAL_U64LE(ctx, val->key);
return false;
}
static bool marshal_Rsession(struct lib9p_ctx *ctx, struct lib9p_msg_Rsession *val, struct _marshal_ret *ret) {
- uint32_t needed_size = 7;
+ uint32_t needed_size = (uint32_t)(7);
if (needed_size > ctx->max_msg_size) {
lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")",
"Rsession",
@@ -4594,15 +4594,15 @@ static bool marshal_Rsession(struct lib9p_ctx *ctx, struct lib9p_msg_Rsession *v
return true;
}
uint32_t offsetof_end = needed_size;
- uint32_t offsetof_size = 0;
- MARSHAL_U32LE(ctx, offsetof_end - offsetof_size);
- MARSHAL_U8LE(ctx, 151);
+ uint32_t offsetof_size = (uint32_t)(0);
+ MARSHAL_U32LE(ctx, (uint32_t)(offsetof_end - offsetof_size));
+ MARSHAL_U8LE(ctx, (uint8_t)(151));
MARSHAL_U16LE(ctx, val->tag);
return false;
}
static bool marshal_Tsread(struct lib9p_ctx *ctx, struct lib9p_msg_Tsread *val, struct _marshal_ret *ret) {
- uint64_t needed_size = 13;
+ uint64_t needed_size = (uint64_t)(13);
for (uint16_t i = 0; i < val->nwname; i++) {
needed_size += 2 + val->wname[i].len;
}
@@ -4614,9 +4614,9 @@ static bool marshal_Tsread(struct lib9p_ctx *ctx, struct lib9p_msg_Tsread *val,
return true;
}
uint32_t offsetof_end = (uint32_t)needed_size;
- uint32_t offsetof_size = 0;
- MARSHAL_U32LE(ctx, offsetof_end - offsetof_size);
- MARSHAL_U8LE(ctx, 152);
+ uint32_t offsetof_size = (uint32_t)(0);
+ MARSHAL_U32LE(ctx, (uint32_t)(offsetof_end - offsetof_size));
+ MARSHAL_U8LE(ctx, (uint8_t)(152));
MARSHAL_U16LE(ctx, val->tag);
MARSHAL_U32LE(ctx, val->fid);
MARSHAL_U16LE(ctx, val->nwname);
@@ -4628,7 +4628,7 @@ static bool marshal_Tsread(struct lib9p_ctx *ctx, struct lib9p_msg_Tsread *val,
}
static bool marshal_Rsread(struct lib9p_ctx *ctx, struct lib9p_msg_Rsread *val, struct _marshal_ret *ret) {
- uint64_t needed_size = 11 + val->count;
+ uint64_t needed_size = (uint64_t)(11 + val->count);
if (needed_size > (uint64_t)(ctx->max_msg_size)) {
lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu64" > %"PRIu32")",
"Rsread",
@@ -4637,9 +4637,9 @@ static bool marshal_Rsread(struct lib9p_ctx *ctx, struct lib9p_msg_Rsread *val,
return true;
}
uint32_t offsetof_end = (uint32_t)needed_size;
- uint32_t offsetof_size = 0;
- MARSHAL_U32LE(ctx, offsetof_end - offsetof_size);
- MARSHAL_U8LE(ctx, 153);
+ uint32_t offsetof_size = (uint32_t)(0);
+ MARSHAL_U32LE(ctx, (uint32_t)(offsetof_end - offsetof_size));
+ MARSHAL_U8LE(ctx, (uint8_t)(153));
MARSHAL_U16LE(ctx, val->tag);
MARSHAL_U32LE(ctx, val->count);
MARSHAL_BYTES_ZEROCOPY(ctx, val->data, val->count);
@@ -4647,7 +4647,7 @@ static bool marshal_Rsread(struct lib9p_ctx *ctx, struct lib9p_msg_Rsread *val,
}
static bool marshal_Tswrite(struct lib9p_ctx *ctx, struct lib9p_msg_Tswrite *val, struct _marshal_ret *ret) {
- uint64_t needed_size = 17 + val->count;
+ uint64_t needed_size = (uint64_t)(17 + val->count);
for (uint16_t i = 0; i < val->nwname; i++) {
needed_size += 2 + val->wname[i].len;
}
@@ -4659,9 +4659,9 @@ static bool marshal_Tswrite(struct lib9p_ctx *ctx, struct lib9p_msg_Tswrite *val
return true;
}
uint32_t offsetof_end = (uint32_t)needed_size;
- uint32_t offsetof_size = 0;
- MARSHAL_U32LE(ctx, offsetof_end - offsetof_size);
- MARSHAL_U8LE(ctx, 154);
+ uint32_t offsetof_size = (uint32_t)(0);
+ MARSHAL_U32LE(ctx, (uint32_t)(offsetof_end - offsetof_size));
+ MARSHAL_U8LE(ctx, (uint8_t)(154));
MARSHAL_U16LE(ctx, val->tag);
MARSHAL_U32LE(ctx, val->fid);
MARSHAL_U16LE(ctx, val->nwname);
@@ -4675,7 +4675,7 @@ static bool marshal_Tswrite(struct lib9p_ctx *ctx, struct lib9p_msg_Tswrite *val
}
static bool marshal_Rswrite(struct lib9p_ctx *ctx, struct lib9p_msg_Rswrite *val, struct _marshal_ret *ret) {
- uint32_t needed_size = 11;
+ uint32_t needed_size = (uint32_t)(11);
if (needed_size > ctx->max_msg_size) {
lib9p_errorf(ctx, LIB9P_ERRNO_L_ERANGE, "%s message too large to marshal into %s limit (%"PRIu32" > %"PRIu32")",
"Rswrite",
@@ -4684,9 +4684,9 @@ static bool marshal_Rswrite(struct lib9p_ctx *ctx, struct lib9p_msg_Rswrite *val
return true;
}
uint32_t offsetof_end = needed_size;
- uint32_t offsetof_size = 0;
- MARSHAL_U32LE(ctx, offsetof_end - offsetof_size);
- MARSHAL_U8LE(ctx, 155);
+ uint32_t offsetof_size = (uint32_t)(0);
+ MARSHAL_U32LE(ctx, (uint32_t)(offsetof_end - offsetof_size));
+ MARSHAL_U8LE(ctx, (uint8_t)(155));
MARSHAL_U16LE(ctx, val->tag);
MARSHAL_U32LE(ctx, val->count);
return false;
diff --git a/lib9p/core_include/lib9p/_core_generated.h b/lib9p/core_include/lib9p/_core_generated.h
index d3b4740..0ffab2b 100644
--- a/lib9p/core_include/lib9p/_core_generated.h
+++ b/lib9p/core_include/lib9p/_core_generated.h
@@ -1475,13 +1475,13 @@ LO_IMPLEMENTATION_H(fmt_formatter, struct lib9p_msg_Twstat, lib9p_msg_Twstat);
#endif
struct lib9p_Tmsg_send_buf {
- size_t iov_cnt;
+ int iov_cnt;
struct iovec iov[LIB9P_TMSG_MAX_IOV];
uint8_t copied[LIB9P_TMSG_MAX_COPY];
};
struct lib9p_Rmsg_send_buf {
- size_t iov_cnt;
+ int iov_cnt;
struct iovec iov[LIB9P_RMSG_MAX_IOV];
uint8_t copied[LIB9P_RMSG_MAX_COPY];
};
diff --git a/lib9p/core_tables.h b/lib9p/core_tables.h
index da2027a..c410db1 100644
--- a/lib9p/core_tables.h
+++ b/lib9p/core_tables.h
@@ -35,7 +35,7 @@ struct _lib9p_recv_tentry {
};
struct _marshal_ret {
- size_t net_iov_cnt;
+ int net_iov_cnt;
struct iovec *net_iov;
size_t net_copied_size;
uint8_t *net_copied;
diff --git a/lib9p/srv.c b/lib9p/srv.c
index fc5d0f2..a4ac369 100644
--- a/lib9p/srv.c
+++ b/lib9p/srv.c
@@ -398,7 +398,7 @@ static void srv_respond_error(struct srv_req *req) {
/* Truncate the error-string if necessary to avoid needing to
* return LIB9P_ERRNO_L_ERANGE. */
if (((uint32_t)host.errstr.len) + overhead > sess->max_msg_size)
- host.errstr.len = sess->max_msg_size - overhead;
+ host.errstr.len = (uint16_t)(sess->max_msg_size - overhead);
struct lib9p_Rmsg_send_buf net;
@@ -409,7 +409,7 @@ static void srv_respond_error(struct srv_req *req) {
srv_msglog(req, LIB9P_TYP_Rerror, &host);
r = srv_write_Rmsg(req, &net);
if (r < 0)
- srv_nonrespond_errorf("write: %s", net_strerror(-r));
+ srv_nonrespond_errorf("write: %s", net_strerror(LM_SAFEDOWNCAST(int, -r)));
}
/* read coroutine *************************************************************/
@@ -421,14 +421,14 @@ static inline bool srv_read_exactly(lo_interface net_stream_conn fd, uint8_t *bu
while (*done < goal) {
ssize_t r = io_read(fd, &buf[*done], goal - *done);
if (r < 0) {
- srv_nonrespond_errorf("read: %s", net_strerror(-r));
+ srv_nonrespond_errorf("read: %s", net_strerror(LM_SAFEDOWNCAST(int, -r)));
return true;
} else if (r == 0) {
if (*done != 0)
srv_nonrespond_errorf("read: unexpected EOF");
return true;
}
- *done += r;
+ *done += LM_SAFEDOWNCAST(size_t, r);
}
return false;
}
@@ -623,7 +623,7 @@ void lib9p_srv_worker(struct srv_req *ctx) {
srv_respond_error(ctx);
goto release;
}
- host_req = calloc(1, host_size);
+ host_req = calloc(1, LM_SAFEDOWNCAST(size_t, host_size));
assert(host_req);
enum lib9p_msg_type typ;
lib9p_Tmsg_unmarshal(&ctx->basectx, ctx->net_bytes,
@@ -1064,7 +1064,7 @@ static void handle_Topen(struct srv_req *ctx,
}
if (stat.mode & LIB9P_DM_APPEND) {
fidflags |= FIDFLAG_APPEND;
- reqmode = reqmode & ~LIB9P_O_TRUNC;
+ reqmode &= LM_BITFLIP(LIB9P_O_TRUNC);
}
uint8_t perm_bits = 0;
bool rd = false, wr = false;
@@ -1277,7 +1277,7 @@ static void handle_Tread(struct srv_req *ctx,
struct iovec iov;
LO_CALL(fidinfo->file.io, pread, ctx, req->count, req->offset, &iov);
if (!lib9p_ctx_has_error(&ctx->basectx) && !ctx->flush_acknowledged) {
- resp.count = iov.iov_len;
+ resp.count = LM_SAFEDOWNCAST(iov.iov_len);
resp.data = iov.iov_base;
if (resp.count > req->count)
resp.count = req->count;
diff --git a/lib9p/tests/test_server/main.c b/lib9p/tests/test_server/main.c
index d7819eb..8490d62 100644
--- a/lib9p/tests/test_server/main.c
+++ b/lib9p/tests/test_server/main.c
@@ -151,7 +151,11 @@ int main(int argc, char *argv[]) {
if (argc != 3)
error(2, 0, "usage: %s PORT_NUMBER LOGFILE", argv[0]);
- globals.port = atoi(argv[1]);
+ int _port = atoi(argv[1]);
+ if (_port == 0 || _port > UINT16_MAX)
+ error(2, 0, "usage: %s PORT_NUMBER LOGFILE", argv[0]);
+
+ globals.port = (uint16_t)_port;
globals.logstream = fopen(argv[2], "w");
if (!globals.logstream)
error(2, errno, "fopen");
diff --git a/lib9p/tests/testclient-sess.c b/lib9p/tests/testclient-sess.c
index 7cb7f97..3e2ba19 100644
--- a/lib9p/tests/testclient-sess.c
+++ b/lib9p/tests/testclient-sess.c
@@ -24,7 +24,7 @@ static void _send9p(int fd, struct lib9p_ctx *ctx, enum lib9p_msg_type typ, void
bool err = lib9p_Tmsg_marshal(ctx, typ, body, &buf);
assert(!err);
size_t exp = 0;
- for (size_t i = 0; i < buf.iov_cnt; i++)
+ for (int i = 0; i < buf.iov_cnt; i++)
exp += buf.iov[i].iov_len;
ssize_t act = writev(fd, buf.iov, buf.iov_cnt);
if (act < 0)
@@ -42,7 +42,7 @@ static void _recv9p(int fd) {
ssize_t n = read(fd, &buf[done], goal-done);
if (n < 0)
error(1, errno, "read");
- done += n;
+ done += (size_t)n;
}
goal = uint32le_decode(buf);
assert(goal <= MAX_MSG_SIZE);
@@ -50,7 +50,7 @@ static void _recv9p(int fd) {
ssize_t n = read(fd, &buf[done], goal-done);
if (n < 0)
error(1, errno, "read");
- done += n;
+ done += (size_t)n;
}
}
@@ -59,7 +59,10 @@ static void _recv9p(int fd) {
int main(int argc, char *argv[]) {
if (argc != 2)
error(2, 0, "Usage: %s SERVER_PORT", argv[0]);
- uint16_t server_port = atoi(argv[1]);
+ int _server_port = atoi(argv[1]);
+ if (_server_port == 0 || _server_port > UINT16_MAX)
+ error(2, 0, "Usage: %s SERVER_PORT", argv[0]);
+ uint16_t server_port = (uint16_t)_server_port;
union {
struct sockaddr gen;