Skip to content

Commit

Permalink
core: tee: initialize dirfile_entry objects
Browse files Browse the repository at this point in the history
Coverity reports many errors where dirfile_entry{} is used
un-initialized.
Resolve these errors by setting these objects to zero on declaration.

Signed-off-by: Clement Faure <clement.faure@nxp.com>
Acked-by: Jerome Forissier <jerome.forissier@linaro.org>
  • Loading branch information
clementfaure committed Aug 22, 2023
1 parent ee8a977 commit f602283
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions core/tee/fs_dirfile.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ TEE_Result tee_fs_dirfile_open(bool create, uint8_t *hash,
goto out;

for (n = 0;; n++) {
struct dirfile_entry dent;
struct dirfile_entry dent = { };

res = read_dent(dirh, n, &dent);
if (res) {
Expand Down Expand Up @@ -289,7 +289,7 @@ TEE_Result tee_fs_dirfile_rename(struct tee_fs_dirfile_dirh *dirh,
const void *oid, size_t oidlen)
{
TEE_Result res;
struct dirfile_entry dent;
struct dirfile_entry dent = { };

if (oidlen > sizeof(dent.oid))
return TEE_ERROR_BAD_PARAMETERS;
Expand Down Expand Up @@ -324,7 +324,7 @@ TEE_Result tee_fs_dirfile_remove(struct tee_fs_dirfile_dirh *dirh,
const struct tee_fs_dirfile_fileh *dfh)
{
TEE_Result res;
struct dirfile_entry dent;
struct dirfile_entry dent = { };
uint32_t file_number;

res = read_dent(dirh, dfh->idx, &dent);
Expand All @@ -350,7 +350,7 @@ TEE_Result tee_fs_dirfile_update_hash(struct tee_fs_dirfile_dirh *dirh,
const struct tee_fs_dirfile_fileh *dfh)
{
TEE_Result res;
struct dirfile_entry dent;
struct dirfile_entry dent = { };

res = read_dent(dirh, dfh->idx, &dent);
if (res)
Expand Down
2 changes: 1 addition & 1 deletion core/tee/tadb.c
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,7 @@ static TEE_Result find_ent(struct tee_tadb_dir *db, const TEE_UUID *uuid,
* with TEE_ERROR_ITEM_NOT_FOUND.
*/
for (idx = 0;; idx++) {
struct tadb_entry entry;
struct tadb_entry entry = { };

res = read_ent(db, idx, &entry);
if (res) {
Expand Down

0 comments on commit f602283

Please sign in to comment.