mmsghdr: workaround -Warray-bounds regression in Red Hat gcc 12/294312/1 accepted/tizen_8.0_unified accepted/tizen_9.0_unified accepted/tizen_unified_dev tizen_8.0 tizen_9.0 accepted/tizen/8.0/unified/20231005.095544 accepted/tizen/9.0/unified/20241030.234342 accepted/tizen/unified/20230616.172420 accepted/tizen/unified/dev/20230726.115421 tizen_8.0_m2_release tizen_9.0_m2_release
authorDmitry V. Levin <ldv@altlinux.org>
Fri, 11 Dec 2020 13:00:00 +0000 (13:00 +0000)
committerSeung-Woo Kim <sw0312.kim@samsung.com>
Fri, 16 Jun 2023 03:58:46 +0000 (12:58 +0900)
commit5a4d0d3141f531f0e393092c6120d18b478fb1e0
tree4bd3e468f56876e6e9016b691beb689a385c537a
parentad55b7c2b63079190afd26332773703cf3d4f309
mmsghdr: workaround -Warray-bounds regression in Red Hat gcc

The version of gcc packaged into Rawhide erroneously produces
the following false positive diagnostics:

mmsghdr.c: In function 'do_recvmmsg':
mmsghdr.c:87:23: error: array subscript 'struct mmsgvec_data[0]' is partly outside array bounds of 'unsigned char[4108]' [-Werror=array-bounds]
   87 |         data->timeout = xstrdup(timeout);
      |         ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~

Tested with:
$ gcc --version |head -1
gcc (GCC) 11.0.0 20201204 (Red Hat 11.0.0-0)

* mmsghdr.c (struct mmsgvec_data): Change namelen[IOV_MAX] to an array
of zero length.

Change-Id: I0bea08bef0937582fbdda9ba7009a7b34251dbd1
mmsghdr.c