Skip to content

Commit

Permalink
zpool_history_unpack: return correct errno on nvlist_unpack failure
Browse files Browse the repository at this point in the history
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Damian Szuberski <szuberskidamian@gmail.com>
Signed-off-by: WHR <msl0000023508@gmail.com>
Closes openzfs#13321
  • Loading branch information
Low-power authored and lundman committed Sep 3, 2022
1 parent b91718f commit e9550e8
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/libzutil/zutil_pool.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,9 @@ zpool_history_unpack(char *buf, uint64_t bytes_read, uint64_t *leftover,
break;

/* unpack record */
if (nvlist_unpack(buf + sizeof (reclen), reclen, &nv, 0) != 0)
return (ENOMEM);
int err = nvlist_unpack(buf + sizeof (reclen), reclen, &nv, 0);
if (err != 0)
return (err);
bytes_read -= sizeof (reclen) + reclen;
buf += sizeof (reclen) + reclen;

Expand Down

0 comments on commit e9550e8

Please sign in to comment.