All of lore.kernel.org
 help / color / mirror / Atom feed
* [xiang-linux:xfs/shrink_lastag 5/5] fs/xfs/xfs_error.c:308 xfs_errortag_add() error: buffer overflow 'xfs_errortag_random_default' 38 <= 38
@ 2021-03-01 17:01 kernel test robot
  0 siblings, 0 replies; 4+ messages in thread
From: kernel test robot @ 2021-03-01 17:01 UTC (permalink / raw)
  To: kbuild

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

CC: kbuild-all(a)lists.01.org
CC: Xiang Gao <xiang@kernel.org>
TO: Gao Xiang <hsiangkao@redhat.com>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/xiang/linux.git xfs/shrink_lastag
head:   95891836ec5d4d45e5fab66bff969fa3f4063d77
commit: 95891836ec5d4d45e5fab66bff969fa3f4063d77 [5/5] xfs: add error injection for per-AG resv failure
:::::: branch date: 7 hours ago
:::::: commit date: 7 hours ago
config: i386-randconfig-m021-20210301 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

smatch warnings:
fs/xfs/xfs_error.c:308 xfs_errortag_add() error: buffer overflow 'xfs_errortag_random_default' 38 <= 38

vim +/xfs_errortag_random_default +308 fs/xfs/xfs_error.c

^1da177e4c3f41 Linus Torvalds  2005-04-16  298  
^1da177e4c3f41 Linus Torvalds  2005-04-16  299  int
31965ef34802f4 Darrick J. Wong 2017-06-20  300  xfs_errortag_add(
31965ef34802f4 Darrick J. Wong 2017-06-20  301  	struct xfs_mount	*mp,
31965ef34802f4 Darrick J. Wong 2017-06-20  302  	unsigned int		error_tag)
^1da177e4c3f41 Linus Torvalds  2005-04-16  303  {
31965ef34802f4 Darrick J. Wong 2017-06-20  304  	if (error_tag >= XFS_ERRTAG_MAX)
31965ef34802f4 Darrick J. Wong 2017-06-20  305  		return -EINVAL;
^1da177e4c3f41 Linus Torvalds  2005-04-16  306  
31965ef34802f4 Darrick J. Wong 2017-06-20  307  	return xfs_errortag_set(mp, error_tag,
31965ef34802f4 Darrick J. Wong 2017-06-20 @308  			xfs_errortag_random_default[error_tag]);
^1da177e4c3f41 Linus Torvalds  2005-04-16  309  }
^1da177e4c3f41 Linus Torvalds  2005-04-16  310  

:::::: The code at line 308 was first introduced by commit
:::::: 31965ef34802f49903bba06dd7c3b96a2e2ed4e4 xfs: make errortag a per-mountpoint structure

:::::: TO: Darrick J. Wong <darrick.wong@oracle.com>
:::::: CC: Darrick J. Wong <darrick.wong@oracle.com>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [xiang-linux:xfs/shrink_lastag 5/5] fs/xfs/xfs_error.c:308 xfs_errortag_add() error: buffer overflow 'xfs_errortag_random_default' 38 <= 38
@ 2021-03-02  7:38 ` Dan Carpenter
  0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2021-03-02  7:38 UTC (permalink / raw)
  To: kbuild

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

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/xiang/linux.git  xfs/shrink_lastag
head:   95891836ec5d4d45e5fab66bff969fa3f4063d77
commit: 95891836ec5d4d45e5fab66bff969fa3f4063d77 [5/5] xfs: add error injection for per-AG resv failure
config: i386-randconfig-m021-20210301 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

smatch warnings:
fs/xfs/xfs_error.c:308 xfs_errortag_add() error: buffer overflow 'xfs_errortag_random_default' 38 <= 38

vim +/xfs_errortag_random_default +308 fs/xfs/xfs_error.c

^1da177e4c3f41 Linus Torvalds  2005-04-16  299  int
31965ef34802f4 Darrick J. Wong 2017-06-20  300  xfs_errortag_add(
31965ef34802f4 Darrick J. Wong 2017-06-20  301  	struct xfs_mount	*mp,
31965ef34802f4 Darrick J. Wong 2017-06-20  302  	unsigned int		error_tag)
^1da177e4c3f41 Linus Torvalds  2005-04-16  303  {
31965ef34802f4 Darrick J. Wong 2017-06-20  304  	if (error_tag >= XFS_ERRTAG_MAX)
                                                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^

31965ef34802f4 Darrick J. Wong 2017-06-20  305  		return -EINVAL;
^1da177e4c3f41 Linus Torvalds  2005-04-16  306  
31965ef34802f4 Darrick J. Wong 2017-06-20  307  	return xfs_errortag_set(mp, error_tag,
31965ef34802f4 Darrick J. Wong 2017-06-20 @308  			xfs_errortag_random_default[error_tag]);
                                                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

It looks like this off by one bug is fixed in commit
dd2149fbe83e ("xfs: add error injection for per-AG resv failure").
You may want to fold that in to the original commit and declare
xfs_errortag_random_default[] as having XFS_ERRTAG_MAX elements.

^1da177e4c3f41 Linus Torvalds  2005-04-16  309  }

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org 

_______________________________________________
kbuild mailing list -- kbuild(a)lists.01.org
To unsubscribe send an email to kbuild-leave(a)lists.01.org

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [kbuild] [xiang-linux:xfs/shrink_lastag 5/5] fs/xfs/xfs_error.c:308 xfs_errortag_add() error: buffer overflow 'xfs_errortag_random_default' 38 <= 38
@ 2021-03-02  7:38 ` Dan Carpenter
  0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2021-03-02  7:38 UTC (permalink / raw)
  To: kbuild-all

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

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/xiang/linux.git  xfs/shrink_lastag
head:   95891836ec5d4d45e5fab66bff969fa3f4063d77
commit: 95891836ec5d4d45e5fab66bff969fa3f4063d77 [5/5] xfs: add error injection for per-AG resv failure
config: i386-randconfig-m021-20210301 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

smatch warnings:
fs/xfs/xfs_error.c:308 xfs_errortag_add() error: buffer overflow 'xfs_errortag_random_default' 38 <= 38

vim +/xfs_errortag_random_default +308 fs/xfs/xfs_error.c

^1da177e4c3f41 Linus Torvalds  2005-04-16  299  int
31965ef34802f4 Darrick J. Wong 2017-06-20  300  xfs_errortag_add(
31965ef34802f4 Darrick J. Wong 2017-06-20  301  	struct xfs_mount	*mp,
31965ef34802f4 Darrick J. Wong 2017-06-20  302  	unsigned int		error_tag)
^1da177e4c3f41 Linus Torvalds  2005-04-16  303  {
31965ef34802f4 Darrick J. Wong 2017-06-20  304  	if (error_tag >= XFS_ERRTAG_MAX)
                                                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^

31965ef34802f4 Darrick J. Wong 2017-06-20  305  		return -EINVAL;
^1da177e4c3f41 Linus Torvalds  2005-04-16  306  
31965ef34802f4 Darrick J. Wong 2017-06-20  307  	return xfs_errortag_set(mp, error_tag,
31965ef34802f4 Darrick J. Wong 2017-06-20 @308  			xfs_errortag_random_default[error_tag]);
                                                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

It looks like this off by one bug is fixed in commit
dd2149fbe83e ("xfs: add error injection for per-AG resv failure").
You may want to fold that in to the original commit and declare
xfs_errortag_random_default[] as having XFS_ERRTAG_MAX elements.

^1da177e4c3f41 Linus Torvalds  2005-04-16  309  }

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org 

_______________________________________________
kbuild mailing list -- kbuild(a)lists.01.org
To unsubscribe send an email to kbuild-leave(a)lists.01.org

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [kbuild] [xiang-linux:xfs/shrink_lastag 5/5] fs/xfs/xfs_error.c:308 xfs_errortag_add() error: buffer overflow 'xfs_errortag_random_default' 38 <= 38
  2021-03-02  7:38 ` [kbuild] " Dan Carpenter
  (?)
@ 2021-03-02  8:16 ` Gao Xiang
  -1 siblings, 0 replies; 4+ messages in thread
From: Gao Xiang @ 2021-03-02  8:16 UTC (permalink / raw)
  To: kbuild-all

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

Hi Dan,

On Tue, Mar 02, 2021 at 10:38:43AM +0300, Dan Carpenter wrote:
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/xiang/linux.git  xfs/shrink_lastag
> head:   95891836ec5d4d45e5fab66bff969fa3f4063d77
> commit: 95891836ec5d4d45e5fab66bff969fa3f4063d77 [5/5] xfs: add error injection for per-AG resv failure
> config: i386-randconfig-m021-20210301 (attached as .config)
> compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
> 
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@intel.com>
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> smatch warnings:
> fs/xfs/xfs_error.c:308 xfs_errortag_add() error: buffer overflow 'xfs_errortag_random_default' 38 <= 38

Thanks for your report. I've got the problem,
and fixed it in
https://git.kernel.org/pub/scm/linux/kernel/git/xiang/linux.git/commit/?h=xfs/shrink_lastag&id=dd2149fbe83e838e4819b90b2233dad20a876f5c

That was a pending patchset intended for reviewing. I will
wait the 0day CI result of fixed version, and send out then.

Thanks,
Gao Xiang

> 
> vim +/xfs_errortag_random_default +308 fs/xfs/xfs_error.c
> 
> ^1da177e4c3f41 Linus Torvalds  2005-04-16  299  int
> 31965ef34802f4 Darrick J. Wong 2017-06-20  300  xfs_errortag_add(
> 31965ef34802f4 Darrick J. Wong 2017-06-20  301  	struct xfs_mount	*mp,
> 31965ef34802f4 Darrick J. Wong 2017-06-20  302  	unsigned int		error_tag)
> ^1da177e4c3f41 Linus Torvalds  2005-04-16  303  {
> 31965ef34802f4 Darrick J. Wong 2017-06-20  304  	if (error_tag >= XFS_ERRTAG_MAX)
>                                                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^
> 
> 31965ef34802f4 Darrick J. Wong 2017-06-20  305  		return -EINVAL;
> ^1da177e4c3f41 Linus Torvalds  2005-04-16  306  
> 31965ef34802f4 Darrick J. Wong 2017-06-20  307  	return xfs_errortag_set(mp, error_tag,
> 31965ef34802f4 Darrick J. Wong 2017-06-20 @308  			xfs_errortag_random_default[error_tag]);
>                                                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> 
> It looks like this off by one bug is fixed in commit
> dd2149fbe83e ("xfs: add error injection for per-AG resv failure").
> You may want to fold that in to the original commit and declare
> xfs_errortag_random_default[] as having XFS_ERRTAG_MAX elements.
> 
> ^1da177e4c3f41 Linus Torvalds  2005-04-16  309  }
> 
> ---
> 0-DAY CI Kernel Test Service, Intel Corporation
> https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org 


> _______________________________________________
> kbuild mailing list -- kbuild(a)lists.01.org
> To unsubscribe send an email to kbuild-leave(a)lists.01.org

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-03-02  8:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-03-02  7:38 [xiang-linux:xfs/shrink_lastag 5/5] fs/xfs/xfs_error.c:308 xfs_errortag_add() error: buffer overflow 'xfs_errortag_random_default' 38 <= 38 Dan Carpenter
2021-03-02  7:38 ` [kbuild] " Dan Carpenter
2021-03-02  8:16 ` Gao Xiang
  -- strict thread matches above, loose matches on Subject: below --
2021-03-01 17:01 kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.