Project

General

Profile

Actions

Bug #14393

open

stmf_sbd: build errors with gcc 11

Added by Toomas Soome 9 days ago. Updated 9 days ago.

Status:
In Progress
Priority:
Normal
Assignee:
Category:
comstar - iSCSI/FC/SAS target
Start date:
Due date:
% Done:

90%

Estimated time:
Difficulty:
Bite-size
Tags:
Gerrit CR:

Description

Build errors:

    ../../common/io/comstar/lu/stmf_sbd/sbd.c: In function 'sbd_set_global_props':
    ../../common/io/comstar/lu/stmf_sbd/sbd.c:2913:60: error: writing 1 byte into a region of size 0 [-Werror=stringop-overflow=]
     2913 |                 mlu_buf[struct_sz - sizeof (*mlu) + 8 - 1] = '\0';
          |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~
    In file included from ../../common/io/comstar/lu/stmf_sbd/sbd.c:49:
    ../../common/sys/stmf_sbd_ioctl.h:138:25: note: at offset 8 into destination object 'mlu_buf' of size 8
      138 |         char            mlu_buf[8];     /* likely more than 8 */
          |                         ^~~~~~~
    cc1: all warnings being treated as errors

    ../../common/io/comstar/lu/stmf_sbd/sbd.c: In function 'sbd_modify_lu':
    ../../common/io/comstar/lu/stmf_sbd/sbd.c:2683:60: error: writing 1 byte into a region of size 0 [-Werror=stringop-overflow=]
     2683 |                 mlu_buf[struct_sz - sizeof (*mlu) + 8 - 1] = '\0';
          |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~
    In file included from ../../common/io/comstar/lu/stmf_sbd/sbd.c:49:
    ../../common/sys/stmf_sbd_ioctl.h:176:25: note: at offset 8 into destination object 'mlu_buf' of size 8
      176 |         char            mlu_buf[8]; /* can be more than 8 */
          |                         ^~~~~~~
    ../../common/io/comstar/lu/stmf_sbd/sbd.c: In function 'sbd_set_global_props':
    ../../common/io/comstar/lu/stmf_sbd/sbd.c:2913:60: error: writing 1 byte into a region of size 0 [-Werror=stringop-overflow=]
     2913 |                 mlu_buf[struct_sz - sizeof (*mlu) + 8 - 1] = '\0';
          |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~
    In file included from ../../common/io/comstar/lu/stmf_sbd/sbd.c:49:
    ../../common/sys/stmf_sbd_ioctl.h:138:25: note: at offset 8 into destination object 'mlu_buf' of size 8
      138 |         char            mlu_buf[8];     /* likely more than 8 */
          |                         ^~~~~~~
    cc1: all warnings being treated as errors

IMO the proper fix would be to use flexible array, but it would mean much more complicated change.

Actions #1

Updated by Electric Monk 9 days ago

  • Gerrit CR set to 1941
Actions

Also available in: Atom PDF