Skip to content

Commit 97190d7

Browse files
bwitherspoonnashif
authored andcommitted
drivers: dac: dac_ad56xx: Fix channel range check
An off by one error in the channel range check results in an out of bound access to the channel lookup array. Signed-off-by: Brett Witherspoon <[email protected]>
1 parent 35c7cd2 commit 97190d7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/dac/dac_ad56xx.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ static int ad56xx_write_value(const struct device *dev, uint8_t channel, uint32_
106106
return -EINVAL;
107107
}
108108

109-
if (channel > config->channel_count) {
109+
if (channel >= config->channel_count) {
110110
LOG_ERR("invalid channel %i", channel);
111111
return -EINVAL;
112112
}

0 commit comments

Comments
 (0)