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 <[email protected]>
Reviewed-by: Damian Szuberski <[email protected]>
Signed-off-by: WHR <[email protected]>
Closes openzfs#13321
  • Loading branch information
Low-power authored and andrewc12 committed Sep 23, 2022
1 parent 7aef194 commit deb9ace
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 deb9ace

Please sign in to comment.