ivila commented on code in PR #179: URL: https://github.com/apache/incubator-teaclave-trustzone-sdk/pull/179#discussion_r2046513152
########## optee-teec/src/context.rs: ########## @@ -57,11 +57,7 @@ impl Context { /// ``` pub fn new() -> Result<Context> { // define an empty TEEC_Context - let mut raw_ctx = raw::TEEC_Context { - fd: 0, - reg_mem: false, - memref_null: false, - }; + let mut raw_ctx = unsafe { std::mem::zeroed() }; Review Comment: I prefer using `unsafe { std::mem::zeroed() }` here. While Rust marks this as unsafe because zero isn't a valid bit pattern for all types, we're only applying it to C structs where a zeroed value is always valid (consistent with how we use `memset` in C). This also avoids unnecessary changes to the `imp` field. While this field (in `TEEC_OPERATION`, `TEEC_Session`, etc) may change over time, we explicitly shouldn't—and don't need to—care about their internal representation. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@teaclave.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@teaclave.apache.org For additional commands, e-mail: dev-h...@teaclave.apache.org