Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fedora 28: misc bounds check compiler warnings #7361

Closed
tonyhutter opened this issue Mar 28, 2018 · 0 comments · Fixed by #7368
Closed

Fedora 28: misc bounds check compiler warnings #7361

tonyhutter opened this issue Mar 28, 2018 · 0 comments · Fixed by #7368
Labels
Type: Building Indicates an issue related to building binaries

Comments

@tonyhutter
Copy link
Contributor

System information

Type Version/Name
Distribution Name Fedora
Distribution Version 28
Linux Kernel 4.16
Architecture x86-64
ZFS Version master
SPL Version master

Describe the problem you're observing

Building ZFS under Fedora 28 produces a number of bounds check warnings. Fedora 28 comes with GCC 8.0.1.

Describe how to reproduce the problem

make

Include any warning/errors/backtraces from the system logs

Some samples:

  CC       lauxlib.lo
In file included from ../../include/sys/zfs_context.h:100,
                 from ../../module/zfs/zio.c:28:
In function ‘umem_cache_create.constprop’,
    inlined from ‘zio_init’ at ../../module/zfs/zio.c:182:23:
../../lib/libspl/include/umem.h:149:3: warning: ‘strncpy’ output may be truncated copying 31 bytes from a string of length 35 [-Wstringop-truncation]
   strncpy(cp->cache_name, name, UMEM_CACHE_NAMELEN);
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In function ‘umem_cache_create.constprop’,
    inlined from ‘zio_init’ at ../../module/zfs/zio.c:186:28:
../../lib/libspl/include/umem.h:149:3: warning: ‘strncpy’ output may be truncated copying 31 bytes from a string of length 35 [-Wstringop-truncation]
   strncpy(cp->cache_name, name, UMEM_CACHE_NAMELEN);
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  CC       lbaselib.lo


make[7]: Entering directory '/home/hutter/fedora28/tests/zfs-tests/tests/functional/cli_root/zfs_diff'
  CC       socket.o
socket.c: In function ‘main’:
socket.c:39:2: warning: ‘strncpy’ specified bound 108 equals destination size [-Wstringop-truncation]
  strncpy(sock.sun_path, (char *)path, sizeof (sock.sun_path));
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  CCLD     socket
make[7]: Leaving directory '/home/hutter/fedora28/tests/zfs-tests/tests/functional/cli_root/zfs_diff'
Making all in zfs_get


make[5]: Entering directory '/home/hutter/fedora28/tests/zfs-tests/cmd/mkbusy'
  CC       mkbusy.o
mkbusy.c: In function ‘main’:
mkbusy.c:141:10: warning: ‘strncpy’ output truncated before terminating nul copying as many bytes from a string as its length [-Wstringop-truncation]
   (void) strncpy(fpath, dname, dlen);
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~
mkbusy.c:129:10: note: length computed here
   dlen = strlen(dname);
          ^~~~~~~~~~~~~
mkbusy.c:143:10: warning: ‘strncat’ output truncated before terminating nul copying as many bytes from a string as its length [-Wstringop-truncation]
   (void) strncat(fpath, fname, flen);
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~
mkbusy.c:130:10: note: length computed here
   flen = strlen(fname);
          ^~~~~~~~~~~~~
  CCLD     mkbusy
make[5]: Leaving directory '/home/hutter/fedora28/tests/zfs-tests/cmd/mkbusy'


Making all in zvol_id
make[3]: Entering directory '/home/hutter/fedora28/cmd/zvol_id'
  CC       zvol_id_main.o
zvol_id_main.c: In function ‘main’:
zvol_id_main.c:92:10: warning: ‘-part’ directive output may be truncated writing 5 bytes into a region of size between 1 and 256 [-Wformat-truncation=]
       "%s-part%d", zvol_name, dev_part);
          ^~~~~
zvol_id_main.c:92:7: note: directive argument in the range [1, 15]
       "%s-part%d", zvol_name, dev_part);
       ^~~~~~~~~~~
zvol_id_main.c:91:3: note: ‘snprintf’ output between 7 and 263 bytes into a destination of size 256
   snprintf(zvol_name_part, ZFS_MAX_DATASET_NAME_LEN,
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       "%s-part%d", zvol_name, dev_part);
       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  CCLD     zvol_id
make[3]: Leaving directory '/home/hutter/fedora28/cmd/zvol_id'
@tonyhutter tonyhutter added the Type: Building Indicates an issue related to building binaries label Mar 28, 2018
tonyhutter added a commit to tonyhutter/zfs that referenced this issue Mar 30, 2018
Fix a bunch of (mostly) sprintf/snprintf truncation compiler
warnings that show up on Fedora 28 (GCC 8.0.1).

Signed-off-by: Tony Hutter <hutter2@llnl.gov>
Closes: openzfs#7361
tonyhutter added a commit to tonyhutter/zfs that referenced this issue Mar 30, 2018
Fix a bunch of (mostly) sprintf/snprintf truncation compiler
warnings that show up on Fedora 28 (GCC 8.0.1).

Signed-off-by: Tony Hutter <hutter2@llnl.gov>
Closes: openzfs#7361
tonyhutter added a commit to tonyhutter/zfs that referenced this issue Apr 3, 2018
Fix a bunch of (mostly) sprintf/snprintf truncation compiler
warnings that show up on Fedora 28 (GCC 8.0.1).

Signed-off-by: Tony Hutter <hutter2@llnl.gov>
Closes: openzfs#7361
behlendorf pushed a commit that referenced this issue Apr 4, 2018
Fix a bunch of (mostly) sprintf/snprintf truncation compiler
warnings that show up on Fedora 28 (GCC 8.0.1).

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Tony Hutter <hutter2@llnl.gov>
Closes #7361 
Closes #7368
tonyhutter added a commit to tonyhutter/zfs that referenced this issue Apr 16, 2018
Fix a bunch of (mostly) sprintf/snprintf truncation compiler
warnings that show up on Fedora 28 (GCC 8.0.1).

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Tony Hutter <hutter2@llnl.gov>
Closes openzfs#7361
Closes openzfs#7368
tonyhutter added a commit to tonyhutter/zfs that referenced this issue May 4, 2018
Fix a bunch of (mostly) sprintf/snprintf truncation compiler
warnings that show up on Fedora 28 (GCC 8.0.1).

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Tony Hutter <hutter2@llnl.gov>
Closes openzfs#7361
Closes openzfs#7368
tonyhutter added a commit that referenced this issue May 10, 2018
Fix a bunch of (mostly) sprintf/snprintf truncation compiler
warnings that show up on Fedora 28 (GCC 8.0.1).

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Tony Hutter <hutter2@llnl.gov>
Closes #7361
Closes #7368
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Building Indicates an issue related to building binaries
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant