drivers: 1wire: Fix DS2XXX device type bounds

EEPROM_DS_COUNT is the number of supported DS2XXX device types and is used as the size of the EEPROM geometry tables. Reject it before storing the device type for later table indexing.

Generated-by: OpenAI Codex
Signed-off-by: aineoae86-sys <ai.neo.ae86@gmail.com>
This commit is contained in:
aineoae86-sys 2026-07-06 02:51:45 +08:00 committed by Alin Jerpelea
parent 6b7f9619f0
commit 0b37b86d68

View file

@ -793,7 +793,7 @@ int ds2xxx_initialize(FAR struct onewire_dev_s *dev,
{
FAR struct ds2xxx_dev_s *priv;
if (devtype < 0 || devtype > EEPROM_DS_COUNT)
if (devtype < 0 || devtype >= EEPROM_DS_COUNT)
{
return -EINVAL;
}