This is an automated email from the ASF dual-hosted git repository.

jerpelea pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 0b37b86d684 drivers: 1wire: Fix DS2XXX device type bounds
0b37b86d684 is described below

commit 0b37b86d68492cf371e4ddc9550db28186092b7f
Author: aineoae86-sys <[email protected]>
AuthorDate: Mon Jul 6 02:51:45 2026 +0800

    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 <[email protected]>
---
 drivers/1wire/1wire_ds2xxx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/1wire/1wire_ds2xxx.c b/drivers/1wire/1wire_ds2xxx.c
index d7438a0c747..980e595921f 100644
--- a/drivers/1wire/1wire_ds2xxx.c
+++ b/drivers/1wire/1wire_ds2xxx.c
@@ -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;
     }

Reply via email to