Skip to contentSkip to conversation

fs/xfs/xfs_message.c:23:40: warning: address of array 'mp->m_super->s_id' will always evaluate to 'true'

PATCH Darrick J. Wong 3 participants 3 messages Oct 30, 2019 – Oct 31, 2019 2 messages not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): 201910291437.fsxNAnIM%[email protected]

A message that is not in the archive (sent off-list or not yet received): 20191030033925.GA14630@ubuntu-m2-xlarge-x86

#2 lore raw
Quoted 6 lines · Nathan Chancellor
Quoted 5 lines · kbuild test robot

CC: kbuild-all(a)lists.01.org
CC: "Darrick J. Wong" <[email protected]>
TO: Ian Kent <[email protected]>
CC: "Darrick J. Wong" <[email protected]>
CC: Christoph Hellwig <[email protected]>

FYI, It's customary to cc the patch author [and the xfs list]...

Quoted 10 lines
Quoted 10 lines
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git mount-api-crash
head:   e35c37b1b9987c8d87d91dbeca6c24aade2a3390
commit: a5a36409da3a608c815b38b0ff2eb5bcfc1adec6 [91/104] xfs: use super s_id instead of struct xfs_mount
config: x86_64-rhel-7.6 (attached as .config)
compiler: clang version 10.0.0 (git://gitmirror/llvm_project 7cd595df96d5929488063d8ff5cc3b5d800386da)
reproduce:
        git checkout a5a36409da3a608c815b38b0ff2eb5bcfc1adec6
        # save the attached .config to linux build tree
        make ARCH=x86_64 
Quoted 8 lines
Quoted 8 lines

If you fix the issue, kindly add following tag

All warnings (new ones prefixed by >>):

Quoted 1 line
Quoted 1 line

fs/xfs/xfs_message.c:23:40: warning: address of array 'mp->m_super->s_id' will always evaluate to 'true' [-Wpointer-bool-conversion]

           if (mp && mp->m_super && mp->m_super->s_id) {
                                 ~~ ~~~~~~~~~~~~~^~~~

...so, Ian, I guess this isn't necessary ^^^^^^^^^^^^^^^^ because it's a char array, not a pointer. :)

Good catch!

--D

Quoted 36 lines
Quoted 22 lines

1 warning generated.

vim +23 fs/xfs/xfs_message.c

    13	
    14	/*
    15	 * XFS logging functions
    16	 */
    17	static void
    18	__xfs_printk(
    19		const char		*level,
    20		const struct xfs_mount	*mp,
    21		struct va_format	*vaf)
    22	{
Quoted 1 line

23 if (mp && mp->m_super && mp->m_super->s_id) {

    24			printk("%sXFS (%s): %pV\n", level, mp->m_super->s_id, vaf);
    25			return;
    26		}
    27		printk("%sXFS: %pV\n", level, vaf);
    28	}
    29	
Quoted 4 lines

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

Hi Darrick,

The 0day team has been doing clang builds for us and we've been forwarding the valid warnings along to developers. This appeared after the commit listed above. That check should be unnecessary, perhaps you meant to check for something else? Thanks for looking into this.

Cheers,
Nathan

#3 lore raw
Quoted 9 lines · Darrick J. Wong
Quoted 6 lines · Nathan Chancellor
Quoted 5 lines · kbuild test robot

CC: [email protected]
CC: "Darrick J. Wong" <[email protected]>
TO: Ian Kent <[email protected]>
CC: "Darrick J. Wong" <[email protected]>
CC: Christoph Hellwig <[email protected]>

FYI, It's customary to cc the patch author [and the xfs list]...

Ugh sorry, was in a rush last night and not paying attention :( will be better next time and thanks for adding the right people!

Cheers,
Nathan

#4 lore raw
In reply to Darrick J. Wong
Quoted 31 lines · Darrick J. Wong
Quoted 6 lines · Nathan Chancellor
Quoted 5 lines · kbuild test robot

CC: [email protected]
CC: "Darrick J. Wong" <[email protected]>
TO: Ian Kent <[email protected]>
CC: "Darrick J. Wong" <[email protected]>
CC: Christoph Hellwig <[email protected]>

FYI, It's customary to cc the patch author [and the xfs list]...

Quoted 21 lines
Quoted 21 lines

tree:
https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git
mount-api-crash

head:   e35c37b1b9987c8d87d91dbeca6c24aade2a3390
commit: a5a36409da3a608c815b38b0ff2eb5bcfc1adec6 [91/104] xfs:

use super s_id instead of struct xfs_mount
config: x86_64-rhel-7.6 (attached as .config)
compiler: clang version 10.0.0 (git://gitmirror/llvm_project
7cd595df96d5929488063d8ff5cc3b5d800386da) reproduce:

        git checkout a5a36409da3a608c815b38b0ff2eb5bcfc1adec6
        # save the attached .config to linux build tree
        make ARCH=x86_64 

If you fix the issue, kindly add following tag

All warnings (new ones prefixed by >>):

Quoted 2 lines
Quoted 2 lines

fs/xfs/xfs_message.c:23:40: warning: address of array 'mp-

Quoted 1 line

m_super->s_id' will always evaluate to 'true' [-Wpointer-

Quoted 8 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line
Quoted 1 line

bool-conversion]

           if (mp && mp->m_super && mp->m_super->s_id) {
                                 ~~ ~~~~~~~~~~~~~^~~~

...so, Ian, I guess this isn't necessary ^^^^^^^^^^^^^^^^ because it's a char array, not a pointer. :)

Good catch!

Indeed, better now than later, ;)

Quoted 44 lines

--D

Quoted 41 lines
Quoted 23 lines

1 warning generated.

vim +23 fs/xfs/xfs_message.c

    13	
    14	/*
    15	 * XFS logging functions
    16	 */
    17	static void
    18	__xfs_printk(
    19		const char		*level,
    20		const struct xfs_mount	*mp,
    21		struct va_format	*vaf)
    22	{
Quoted 1 line

23 if (mp && mp->m_super && mp->m_super->s_id) {

    24			printk("%sXFS (%s): %pV\n", level, mp-
Quoted 1 line

m_super->s_id, vaf);

    25			return;
    26		}
    27		printk("%sXFS: %pV\n", level, vaf);
    28	}
    29	
Quoted 6 lines

---
0-DAY kernel test infrastructure Open Source
Technology Center
https://lists.01.org/pipermail/kbuild-all Intel
Corporation

Hi Darrick,

The 0day team has been doing clang builds for us and we've been forwarding the valid warnings along to developers. This appeared after
the commit listed above. That check should be unnecessary, perhaps you
meant to check for something else? Thanks for looking into this.

Cheers,
Nathan