btrfs-progs/convert
Qu Wenruo ac75513621 btrfs-progs: convert: fix the pointer sign warning for ext2 label
[WARNING]
When compiling btrfs-progs, there is one warning from convert ext2 code:
  convert/source-ext2.c: In function 'ext2_open_fs':
  convert/source-ext2.c:91:44: warning: pointer targets in passing argument 1 of 'strndup' differ in signedness [-Wpointer-sign]
     91 |  cctx->volume_name = strndup(ext2_fs->super->s_volume_name, 16);
        |                              ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
        |                                            |
        |                                            __u8 * {aka unsigned char *}
  In file included from ./kerncompat.h:25,
                   from convert/source-ext2.c:19:
  /usr/include/string.h:175:35: note: expected 'const char *' but argument is of type '__u8 *' {aka 'unsigned char *'}
    175 | extern char *strndup (const char *__string, size_t __n)
        |                       ~~~~~~~~~~~~^~~~~~~~

The toolchain involved is:
- GCC 10.1.0
- e2fsprogs 1.45.6

[CAUSE]
Obviously, in the offending e2fsprogs, the volume label is using u8,
which is unsigned char, not char.

  /*078*/	__u8	s_volume_name[EXT2_LABEL_LEN];	/* volume name, no NUL? */

[FIX]
Just do a forced conversion to suppress the warning is enough.
I don't think we need to apply -Wnopointer-sign yet.

Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2020-06-29 17:45:39 +02:00
..
common.c btrfs-progs: sync block group item accessors from kernel 2020-05-11 20:49:46 +02:00
common.h btrfs-progs: lots of typo fixes (codespell) 2020-03-31 18:37:38 +02:00
main.c btrfs-progs: fsfeatures: introduce runtime features 2020-05-28 19:59:56 +02:00
Makefile btrfs-progs: build: add stub makefile to convert 2017-03-08 13:00:46 +01:00
source-ext2.c btrfs-progs: convert: fix the pointer sign warning for ext2 label 2020-06-29 17:45:39 +02:00
source-ext2.h btrfs-progs: convert: fix support for e2fsprogs < 1.42 2018-06-07 16:37:35 +02:00
source-fs.c btrfs-progs: rename btrfs_block_group_cache to btrfs_block_group 2020-05-11 20:50:00 +02:00
source-fs.h btrfs-progs: fix typos in comments 2018-11-26 18:24:48 +01:00
source-reiserfs.c btrfs-progs: lots of typo fixes (codespell) 2020-03-31 18:37:38 +02:00
source-reiserfs.h btrfs-progs: convert: move reiserfs struct definitions to header 2017-09-08 16:15:05 +02:00