git: asr(4): Fix bug of DPT_4_BYTES being wrongly defined as long (8 bytes)

Aaron LI aly at crater.dragonflybsd.org
Tue Oct 13 23:15:10 PDT 2026


commit 755c957fb74569c9b9aef29c764bd0f69bfd0920
Author: Aaron LI <aly at aaronly.me>
Date:   Wed Oct 14 14:03:37 2026 +0800

    asr(4): Fix bug of DPT_4_BYTES being wrongly defined as long (8 bytes)
    
    Caught by GCC 12.5 with the following '-Warray-bounds' warnings:
    
    ```
    In file included from /usr/src/sys/dev/raid/asr/asr.c:148:
    /usr/src/sys/dev/raid/asr/asr.c: In function 'ASR_getStatus':
    /usr/src/sys/dev/raid/asr/dptalign.h:277:26: warning: array subscript 'long unsigned int[4]' is partly outside array bounds of 'I2O_EXEC_STATUS_GET_MESSAGE[1]' {aka 'struct _I2O_EXEC_STATUS_GET_MESSAGE[1]'} [-Warray-bounds]
      277 |                          *((unsigned DPT_4_BYTES __FAR__ *)getUP1(x,y)) \
          |                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /usr/src/sys/dev/raid/asr/i2odep.h:492:17: note: in expansion of macro 'setLU4'
      492 |                 setLU4((&(x)->ReplyBufferLength),0,y)
          |                 ^~~~~~
    /usr/src/sys/dev/raid/asr/asr.c:614:9: note: in expansion of macro 'I2O_EXEC_STATUS_GET_MESSAGE_setReplyBufferLength'
      614 |         I2O_EXEC_STATUS_GET_MESSAGE_setReplyBufferLength(Message_Ptr,
          |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /usr/src/sys/dev/raid/asr/asr.c:599:41: note: at offset 32 into object 'Message' of size 36
      599 |         I2O_EXEC_STATUS_GET_MESSAGE     Message;
          |                                         ^~~~~~~
    
    /usr/src/sys/dev/raid/asr/asr.c: In function 'ASR_acquireLct':
    /usr/src/sys/dev/raid/asr/dptalign.h:277:26: warning: array subscript 'long unsigned int[3]' is partly outside array bounds of 'unsigned char[32]' [-Warray-bounds]
      277 |                          *((unsigned DPT_4_BYTES __FAR__ *)getUP1(x,y)) \
          |                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /usr/src/sys/dev/raid/asr/i2odep.h:304:9: note: in expansion of macro 'setLU4'
      304 |         setLU4((&(x)->PhysicalAddress),0,y)
          |         ^~~~~~
    /usr/src/sys/dev/raid/asr/asr.c:1378:9: note: in expansion of macro 'I2O_SGE_SIMPLE_ELEMENT_setPhysicalAddress'
     1378 |         I2O_SGE_SIMPLE_ELEMENT_setPhysicalAddress(                 \
          |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /usr/src/sys/dev/raid/asr/asr.c:1484:9: note: in expansion of macro 'SG'
     1484 |         SG(&(Message_Ptr->SGL), 0,
          |         ^~
    ```

Summary of changes:
 sys/dev/raid/asr/dptalign.h | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/755c957fb74569c9b9aef29c764bd0f69bfd0920


-- 
DragonFly BSD source repository


More information about the Commits mailing list