NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: port-sparc64/61087: NetBSD 11.1 RELEASE kernel fails to build for sparc64 with KUBSAN enabled



The following reply was made to PR port-sparc64/61087; it has been noted by GNATS.

From: Valery Ushakov <uwe%stderr.spb.ru@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc: 
Subject: Re: port-sparc64/61087: NetBSD 11.1 RELEASE kernel fails to build
 for sparc64 with KUBSAN enabled
Date: Mon, 30 Nov 2026 01:13:39 +0300

 > In file included from /usr/src/sys/dev/rasops/rasops1.c:49:
 > /usr/src/sys/dev/rasops/rasops_bitops.h: In function 'rasops1_copycols':
 > /usr/src/sys/dev/rasops/rasops_masks.h:85:50: error: array subscript 2147483616 is above array bounds of 'const uint32_t[33]' {aka 'const unsigned int[33]'} [-Werror=array-bounds]
 >    85 |                 (dp)[1] = ((dp)[1] & rasops_rmask[n]) |                 \
 >       |                                      ~~~~~~~~~~~~^~~
 > /usr/src/sys/dev/rasops/rasops_bitops.h:279:25: note: in expansion of macro 'PUTBITS'
 >   279 |                         PUTBITS(tmp, db, num, drp);
 >       |                         ^~~~~~~
 > /usr/src/sys/dev/rasops/rasops_masks.h:92:25: note: while referencing 'rasops_rmask'
 >    92 | extern const uint32_t   rasops_rmask[32 + 1];
 >       |                         ^~~~~~~~~~~~
 
 At a quick glance - that looks a bit suspicious.  rasops_bitops.h:279
 is in copycols, inside "if (db + num <= 32)".
 
 PUTBITS(tmp, db, num, drp) expands to
 
   #define PUTBITS(sw, x, w, dp) do { \
 	int n = (x) + (w) - 32;      \
 	if (n <= 0) {                \
   ...
 
 so
 
   int n = db + num - 32;
 
 but we are inside that (db + num <= 32) guard, so we know n <= 0
 
 But rasops_rmask[n] and rasops_lmask[n] accesses it complains about
 are inside the _other_ branch of that if (n <= 0)
 
 Do I miss something in the above?
 
 -uwe
 



Home | Main Index | Thread Index | Old Index