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

xiaoxiang781216 pushed a commit to branch releases/13.0
in repository https://gitbox.apache.org/repos/asf/nuttx.git


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

commit bc764dc9bd25f328aafc29d5685fc35cb61d79f7
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