From: Ivan Khoronzhuk ivan.khoronzhuk@globallogic.com
Should close object created for reading, so better use seek and then close the object.
Fixes: b29b41950 ("ta: add AVB TA") Signed-off-by: Ivan Khoronzhuk ivan.khoronzhuk@globallogic.com --- ta/avb/entry.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/ta/avb/entry.c b/ta/avb/entry.c index 4e57003e..a6e01035 100644 --- a/ta/avb/entry.c +++ b/ta/avb/entry.c @@ -239,7 +239,11 @@ static TEE_Result write_lock_state(uint32_t pt, if (count == sizeof(lock_state) && lock_state == wlock_state) goto out;
- res = create_rb_state(wlock_state, &h); + res = TEE_SeekObjectData(h, 0, TEE_DATA_SEEK_SET); + if (res) + goto out; + + res = TEE_WriteObjectData(h, &wlock_state, sizeof(wlock_state)); out: TEE_CloseObject(h); return res;
Hi Ivan,
On Sat, Jan 21, 2023 at 6:45 AM Ivan Khoronzhuk ivan.khoronzhuk@gmail.com wrote:
From: Ivan Khoronzhuk ivan.khoronzhuk@globallogic.com
Should close object created for reading, so better use seek and then close the object.
Fixes: b29b41950 ("ta: add AVB TA") Signed-off-by: Ivan Khoronzhuk ivan.khoronzhuk@globallogic.com
ta/avb/entry.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/ta/avb/entry.c b/ta/avb/entry.c index 4e57003e..a6e01035 100644 --- a/ta/avb/entry.c +++ b/ta/avb/entry.c @@ -239,7 +239,11 @@ static TEE_Result write_lock_state(uint32_t pt, if (count == sizeof(lock_state) && lock_state == wlock_state) goto out;
res = create_rb_state(wlock_state, &h);
res = TEE_SeekObjectData(h, 0, TEE_DATA_SEEK_SET);
if (res)
goto out;
res = TEE_WriteObjectData(h, &wlock_state, sizeof(wlock_state));
out: TEE_CloseObject(h); return res; -- 2.34.1
The patch looks good. Would you mind opening a pull request at https://github.com/OP-TEE/optee_os?
Cheers, Jens
op-tee@lists.trustedfirmware.org