Linux-ext4 Archive on lore.kernel.org
 help / color / Atom feed
From: kbuild test robot <lkp@intel.com>
To: Theodore Ts'o <tytso@mit.edu>
Cc: kbuild-all@lists.01.org,
	Ext4 Developers List <linux-ext4@vger.kernel.org>,
	Theodore Ts'o <tytso@mit.edu>,
	syzbot+f8d6f8386ceacdbfff57@syzkaller.appspotmail.com,
	stable@kernel.org
Subject: Re: [PATCH] ext4: add more paranoia checking in ext4_expand_extra_isize handling
Date: Sun, 10 Nov 2019 18:12:44 +0800
Message-ID: <201911101835.qg5bu1Me%lkp@intel.com> (raw)
In-Reply-To: <20191108024841.9668-1-tytso@mit.edu>

[-- Attachment #1: Type: text/plain, Size: 5175 bytes --]

Hi Theodore,

I love your patch! Perhaps something to improve:

[auto build test WARNING on ext4/dev]
[also build test WARNING on v5.4-rc6 next-20191108]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Theodore-Ts-o/ext4-add-more-paranoia-checking-in-ext4_expand_extra_isize-handling/20191110-005324
base:   https://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4.git dev
config: i386-randconfig-d003-201945 (attached as .config)
compiler: gcc-7 (Debian 7.4.0-14) 7.4.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

   In file included from include/linux/export.h:44:0,
                    from include/linux/linkage.h:7,
                    from include/linux/fs.h:5,
                    from fs//ext4/inode.c:22:
   fs//ext4/inode.c: In function '__ext4_expand_extra_isize':
   fs//ext4/inode.c:5576:34: error: 'ei' undeclared (first use in this function)
     if ((EXT4_GOOD_OLD_INODE_SIZE + ei->i_extra_isize > inode_size) ||
                                     ^
   include/linux/compiler.h:58:52: note: in definition of macro '__trace_if_var'
    #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                                       ^~~~
>> fs//ext4/inode.c:5576:2: note: in expansion of macro 'if'
     if ((EXT4_GOOD_OLD_INODE_SIZE + ei->i_extra_isize > inode_size) ||
     ^~
   fs//ext4/inode.c:5576:34: note: each undeclared identifier is reported only once for each function it appears in
     if ((EXT4_GOOD_OLD_INODE_SIZE + ei->i_extra_isize > inode_size) ||
                                     ^
   include/linux/compiler.h:58:52: note: in definition of macro '__trace_if_var'
    #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                                       ^~~~
>> fs//ext4/inode.c:5576:2: note: in expansion of macro 'if'
     if ((EXT4_GOOD_OLD_INODE_SIZE + ei->i_extra_isize > inode_size) ||
     ^~
   fs//ext4/inode.c:5585:7: error: 'new_extra_size' undeclared (first use in this function); did you mean 'new_extra_isize'?
         (new_extra_size > inode_size - EXT4_GOOD_OLD_INODE_SIZE))
          ^
   include/linux/compiler.h:58:52: note: in definition of macro '__trace_if_var'
    #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                                       ^~~~
   fs//ext4/inode.c:5583:2: note: in expansion of macro 'if'
     if ((new_extra_isize < ei->i_extra_size) ||
     ^~
   fs//ext4/inode.c:5586:3: error: 'retun' undeclared (first use in this function); did you mean 'semun'?
      retun -EINVAL; /* Should never happen */
      ^~~~~
      semun

vim +/if +5576 fs//ext4/inode.c

  5564	
  5565	static int __ext4_expand_extra_isize(struct inode *inode,
  5566					     unsigned int new_extra_isize,
  5567					     struct ext4_iloc *iloc,
  5568					     handle_t *handle, int *no_expand)
  5569	{
  5570		struct ext4_inode *raw_inode;
  5571		struct ext4_xattr_ibody_header *header;
  5572		unsigned int inode_size = EXT4_INODE_SIZE(inode->i_sb);
  5573		int error;
  5574	
  5575		/* this was checked at iget time, but double check for good measure */
> 5576		if ((EXT4_GOOD_OLD_INODE_SIZE + ei->i_extra_isize > inode_size) ||
  5577		    (ei->i_extra_isize & 3)) {
  5578			EXT4_ERROR_INODE(inode, "bad extra_isize %u (inode size %u)",
  5579					 ei->i_extra_isize,
  5580					 EXT4_INODE_SIZE(inode->i_sb));
  5581			return -EFSCORRUPTED;
  5582		}
  5583		if ((new_extra_isize < ei->i_extra_size) ||
  5584		    (new_extra_isize < 4) ||
  5585		    (new_extra_size > inode_size - EXT4_GOOD_OLD_INODE_SIZE))
  5586			retun -EINVAL;	/* Should never happen */
  5587	
  5588		raw_inode = ext4_raw_inode(iloc);
  5589	
  5590		header = IHDR(inode, raw_inode);
  5591	
  5592		/* No extended attributes present */
  5593		if (!ext4_test_inode_state(inode, EXT4_STATE_XATTR) ||
  5594		    header->h_magic != cpu_to_le32(EXT4_XATTR_MAGIC)) {
  5595			memset((void *)raw_inode + EXT4_GOOD_OLD_INODE_SIZE +
  5596			       EXT4_I(inode)->i_extra_isize, 0,
  5597			       new_extra_isize - EXT4_I(inode)->i_extra_isize);
  5598			EXT4_I(inode)->i_extra_isize = new_extra_isize;
  5599			return 0;
  5600		}
  5601	
  5602		/* try to expand with EAs present */
  5603		error = ext4_expand_extra_isize_ea(inode, new_extra_isize,
  5604						   raw_inode, handle);
  5605		if (error) {
  5606			/*
  5607			 * Inode size expansion failed; don't try again
  5608			 */
  5609			*no_expand = 1;
  5610		}
  5611	
  5612		return error;
  5613	}
  5614	

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

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 38678 bytes --]

  reply index

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-08  2:48 Theodore Ts'o
2019-11-10 10:12 ` kbuild test robot [this message]
2019-11-10 12:15   ` [PATCH -v2] " Theodore Y. Ts'o

Reply instructions:

You may reply publically to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201911101835.qg5bu1Me%lkp@intel.com \
    --to=lkp@intel.com \
    --cc=kbuild-all@lists.01.org \
    --cc=linux-ext4@vger.kernel.org \
    --cc=stable@kernel.org \
    --cc=syzbot+f8d6f8386ceacdbfff57@syzkaller.appspotmail.com \
    --cc=tytso@mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Linux-ext4 Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-ext4/0 linux-ext4/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-ext4 linux-ext4/ https://lore.kernel.org/linux-ext4 \
		linux-ext4@vger.kernel.org
	public-inbox-index linux-ext4

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-ext4


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git