Skip to content

Commit

Permalink
vdev_draid_lookup_map() should not iterate outside draid_maps
Browse files Browse the repository at this point in the history
Coverity reported this as an out-of-bounds read.

Reviewed-by: Alexander Motin <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Neal Gompa <[email protected]>
Signed-off-by: Richard Yao <[email protected]>
Closes #13865
  • Loading branch information
ryao authored and tonyhutter committed Sep 15, 2022
1 parent 03fa3ef commit 3f7c174
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion module/zfs/vdev_draid.c
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ vdev_draid_generate_perms(const draid_map_t *map, uint8_t **permsp)
int
vdev_draid_lookup_map(uint64_t children, const draid_map_t **mapp)
{
for (int i = 0; i <= VDEV_DRAID_MAX_MAPS; i++) {
for (int i = 0; i < VDEV_DRAID_MAX_MAPS; i++) {
if (draid_maps[i].dm_children == children) {
*mapp = &draid_maps[i];
return (0);
Expand Down

0 comments on commit 3f7c174

Please sign in to comment.