xfs: fix warnings in compat_ioctl code
PATCH 1/1 xfs: fix warnings in compat_ioctl code
From: Darrick J. Wong <[email protected]>
Fix some compiler warnings about unused variables.
--- fs/xfs/xfs_ioctl32.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/xfs/xfs_ioctl32.c +2 -1
@@ -439,7 +439,6 @@ xfs_file_compat_ioctl(struct inode *inode =file_inode (filp);struct xfs_inode *ip =XFS_I (inode);void __user *arg =compat_ptr (p); -int error;trace_xfs_file_compat_ioctl (ip);
@@ -460,6 +459,7 @@ xfs_file_compat_ioctl(return xfs_compat_ioc_fsgeometry_v1 (ip->i_mount, arg);case XFS_IOC_FSGROWFSDATA_32 : {struct xfs_growfs_data in; +int error;if (xfs_compat_growfs_data_copyin (&in, arg))return -EFAULT ;
@@ -472,6 +472,7 @@ xfs_file_compat_ioctl( }case XFS_IOC_FSGROWFSRT_32 : {struct xfs_growfs_rt in; +int error;if (xfs_compat_growfs_rt_copyin (&in, arg))return -EFAULT ;
kernel test robot
build botI love your patch! Yet something to improve:
Hi "Darrick,
I love your patch! Yet something to improve:
[auto build test ERROR on xfs-linux/for-next]
[also build test ERROR on v5.13 next-20210701]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Darrick-J-Wong/xfs-fix-warnings-in-compat_ioctl-code/20210703-110255 base: https://git.kernel.org/pub/scm/fs/xfs/xfs-linux.git for-next config: x86_64-rhel-8.3 (attached as .config) compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce (this is a W=1 build):
# https://github.com/0day-ci/linux/commit/e732c9295d84f78d487313cf5056d47ecd6d0d4a
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Darrick-J-Wong/xfs-fix-warnings-in-compat_ioctl-code/20210703-110255 git checkout e732c9295d84f78d487313cf5056d47ecd6d0d4a
# save the attached .config to linux build tree
mkdir build_dir
make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash drivers/tty/ fs/xfs/
If you fix the issue, kindly add following tag as appropriate
All errors (new ones prefixed by >>):
fs/xfs/xfs_ioctl32.c: In function 'xfs_file_compat_ioctl':
>> fs/xfs/xfs_ioctl32.c:500:3: error: 'error' undeclared (first use in this function); did you mean 'PG_error'?
500 | error = mnt_want_write_file(filp);
| ^~~~~
| PG_error
fs/xfs/xfs_ioctl32.c:500:3: note: each undeclared identifier is reported only once for each function it appears in
fs/xfs/xfs_ioctl32.c:491:27: warning: this statement may fall through [-Wimplicit-fallthrough=]
491 | case XFS_IOC_SWAPEXT_32: {
| ^
fs/xfs/xfs_ioctl32.c:507:2: note: here
507 | case XFS_IOC_FSBULKSTAT_32:
| ^~~~vim +500 fs/xfs/xfs_ioctl32.c
28750975ace79c fs/xfs/linux-2.6/xfs_ioctl32.c sandeen(a)sandeen.net 2008-11-25 432
4d4be482a4d78c fs/xfs/linux-2.6/xfs_ioctl32.c Christoph Hellwig 2008-12-09 433 long
4d4be482a4d78c fs/xfs/linux-2.6/xfs_ioctl32.c Christoph Hellwig 2008-12-09 434 xfs_file_compat_ioctl(
d5547f9feea459 fs/xfs/linux-2.6/xfs_ioctl32.c sandeen(a)sandeen.net 2008-11-25 435 struct file *filp,
e0edd5962bd83d fs/xfs/linux-2.6/xfs_ioctl32.c Nathan Scott 2006-03-29 436 unsigned cmd,
4d4be482a4d78c fs/xfs/linux-2.6/xfs_ioctl32.c Christoph Hellwig 2008-12-09 437 unsigned long p)
^1da177e4c3f41 fs/xfs/linux-2.6/xfs_ioctl32.c Linus Torvalds 2005-04-16 438 {
496ad9aa8ef448 fs/xfs/xfs_ioctl32.c Al Viro 2013-01-23 439 struct inode *inode = file_inode(filp);
4d4be482a4d78c fs/xfs/linux-2.6/xfs_ioctl32.c Christoph Hellwig 2008-12-09 440 struct xfs_inode *ip = XFS_I(inode);
4529e6d7a6ab72 fs/xfs/xfs_ioctl32.c Christoph Hellwig 2019-08-15 441 void __user *arg = compat_ptr(p);
^1da177e4c3f41 fs/xfs/linux-2.6/xfs_ioctl32.c Linus Torvalds 2005-04-16 442
cca28fb83d9e60 fs/xfs/linux-2.6/xfs_ioctl32.c Christoph Hellwig 2010-06-24 443 trace_xfs_file_compat_ioctl(ip);
4d4be482a4d78c fs/xfs/linux-2.6/xfs_ioctl32.c Christoph Hellwig 2008-12-09 444
^1da177e4c3f41 fs/xfs/linux-2.6/xfs_ioctl32.c Linus Torvalds 2005-04-16 445 switch (cmd) {
a9d25bde1e9b24 fs/xfs/xfs_ioctl32.c Nick Bowler 2018-12-17 446 #if defined(BROKEN_X86_ALIGNMENT)
526c420c44b45b fs/xfs/linux-2.6/xfs_ioctl32.c Eric Sandeen 2005-09-05 447 case XFS_IOC_ALLOCSP_32:
526c420c44b45b fs/xfs/linux-2.6/xfs_ioctl32.c Eric Sandeen 2005-09-05 448 case XFS_IOC_FREESP_32:
526c420c44b45b fs/xfs/linux-2.6/xfs_ioctl32.c Eric Sandeen 2005-09-05 449 case XFS_IOC_ALLOCSP64_32:
837a6e7f5cdb5e fs/xfs/xfs_ioctl32.c Christoph Hellwig 2019-10-24 450 case XFS_IOC_FREESP64_32: {
d5547f9feea459 fs/xfs/linux-2.6/xfs_ioctl32.c sandeen(a)sandeen.net 2008-11-25 451 struct xfs_flock64 bf;
d5547f9feea459 fs/xfs/linux-2.6/xfs_ioctl32.c sandeen(a)sandeen.net 2008-11-25 452
d5547f9feea459 fs/xfs/linux-2.6/xfs_ioctl32.c sandeen(a)sandeen.net 2008-11-25 453 if (xfs_compat_flock64_copyin(&bf, arg))
b474c7ae4395ba fs/xfs/xfs_ioctl32.c Eric Sandeen 2014-06-22 454 return -EFAULT;
526c420c44b45b fs/xfs/linux-2.6/xfs_ioctl32.c Eric Sandeen 2005-09-05 455 cmd = _NATIVE_IOC(cmd, struct xfs_flock64);
837a6e7f5cdb5e fs/xfs/xfs_ioctl32.c Christoph Hellwig 2019-10-24 456 return xfs_ioc_space(filp, &bf);
d5547f9feea459 fs/xfs/linux-2.6/xfs_ioctl32.c sandeen(a)sandeen.net 2008-11-25 457 }
547e00c3c68126 fs/xfs/linux-2.6/xfs_ioctl32.c Michal Marek 2007-07-11 458 case XFS_IOC_FSGEOMETRY_V1_32:
f69e8091c4a2ae fs/xfs/xfs_ioctl32.c Christoph Hellwig 2021-02-03 459 return xfs_compat_ioc_fsgeometry_v1(ip->i_mount, arg);
471d59103167c8 fs/xfs/linux-2.6/xfs_ioctl32.c sandeen(a)sandeen.net 2008-11-25 460 case XFS_IOC_FSGROWFSDATA_32: {
471d59103167c8 fs/xfs/linux-2.6/xfs_ioctl32.c sandeen(a)sandeen.net 2008-11-25 461 struct xfs_growfs_data in;
e732c9295d84f7 fs/xfs/xfs_ioctl32.c Darrick J. Wong 2021-07-02 462 int error;
471d59103167c8 fs/xfs/linux-2.6/xfs_ioctl32.c sandeen(a)sandeen.net 2008-11-25 463
471d59103167c8 fs/xfs/linux-2.6/xfs_ioctl32.c sandeen(a)sandeen.net 2008-11-25 464 if (xfs_compat_growfs_data_copyin(&in, arg))
b474c7ae4395ba fs/xfs/xfs_ioctl32.c Eric Sandeen 2014-06-22 465 return -EFAULT;
d9457dc0562499 fs/xfs/xfs_ioctl32.c Jan Kara 2012-06-12 466 error = mnt_want_write_file(filp);
d9457dc0562499 fs/xfs/xfs_ioctl32.c Jan Kara 2012-06-12 467 if (error)
d9457dc0562499 fs/xfs/xfs_ioctl32.c Jan Kara 2012-06-12 468 return error;
f69e8091c4a2ae fs/xfs/xfs_ioctl32.c Christoph Hellwig 2021-02-03 469 error = xfs_growfs_data(ip->i_mount, &in);
d9457dc0562499 fs/xfs/xfs_ioctl32.c Jan Kara 2012-06-12 470 mnt_drop_write_file(filp);
2451337dd04390 fs/xfs/xfs_ioctl32.c Dave Chinner 2014-06-25 471 return error;
471d59103167c8 fs/xfs/linux-2.6/xfs_ioctl32.c sandeen(a)sandeen.net 2008-11-25 472 }
471d59103167c8 fs/xfs/linux-2.6/xfs_ioctl32.c sandeen(a)sandeen.net 2008-11-25 473 case XFS_IOC_FSGROWFSRT_32: {
471d59103167c8 fs/xfs/linux-2.6/xfs_ioctl32.c sandeen(a)sandeen.net 2008-11-25 474 struct xfs_growfs_rt in;
e732c9295d84f7 fs/xfs/xfs_ioctl32.c Darrick J. Wong 2021-07-02 475 int error;
471d59103167c8 fs/xfs/linux-2.6/xfs_ioctl32.c sandeen(a)sandeen.net 2008-11-25 476
471d59103167c8 fs/xfs/linux-2.6/xfs_ioctl32.c sandeen(a)sandeen.net 2008-11-25 477 if (xfs_compat_growfs_rt_copyin(&in, arg))
b474c7ae4395ba fs/xfs/xfs_ioctl32.c Eric Sandeen 2014-06-22 478 return -EFAULT;
d9457dc0562499 fs/xfs/xfs_ioctl32.c Jan Kara 2012-06-12 479 error = mnt_want_write_file(filp);
d9457dc0562499 fs/xfs/xfs_ioctl32.c Jan Kara 2012-06-12 480 if (error)
d9457dc0562499 fs/xfs/xfs_ioctl32.c Jan Kara 2012-06-12 481 return error;
f69e8091c4a2ae fs/xfs/xfs_ioctl32.c Christoph Hellwig 2021-02-03 482 error = xfs_growfs_rt(ip->i_mount, &in);
d9457dc0562499 fs/xfs/xfs_ioctl32.c Jan Kara 2012-06-12 483 mnt_drop_write_file(filp);
2451337dd04390 fs/xfs/xfs_ioctl32.c Dave Chinner 2014-06-25 484 return error;
471d59103167c8 fs/xfs/linux-2.6/xfs_ioctl32.c sandeen(a)sandeen.net 2008-11-25 485 }
^1da177e4c3f41 fs/xfs/linux-2.6/xfs_ioctl32.c Linus Torvalds 2005-04-16 486 #endif
e5d412f17846b0 fs/xfs/linux-2.6/xfs_ioctl32.c sandeen(a)sandeen.net 2008-11-25 487 /* long changes size, but xfs only copiese out 32 bits */
e5d412f17846b0 fs/xfs/linux-2.6/xfs_ioctl32.c sandeen(a)sandeen.net 2008-11-25 488 case XFS_IOC_GETVERSION_32:
e5d412f17846b0 fs/xfs/linux-2.6/xfs_ioctl32.c sandeen(a)sandeen.net 2008-11-25 489 cmd = _NATIVE_IOC(cmd, long);
4d4be482a4d78c fs/xfs/linux-2.6/xfs_ioctl32.c Christoph Hellwig 2008-12-09 490 return xfs_file_ioctl(filp, cmd, p);
3725867dccfb83 fs/xfs/linux-2.6/xfs_ioctl32.c Christoph Hellwig 2009-09-01 491 case XFS_IOC_SWAPEXT_32: {
e5d412f17846b0 fs/xfs/linux-2.6/xfs_ioctl32.c sandeen(a)sandeen.net 2008-11-25 492 struct xfs_swapext sxp;
e5d412f17846b0 fs/xfs/linux-2.6/xfs_ioctl32.c sandeen(a)sandeen.net 2008-11-25 493 struct compat_xfs_swapext __user *sxu = arg;
e5d412f17846b0 fs/xfs/linux-2.6/xfs_ioctl32.c sandeen(a)sandeen.net 2008-11-25 494
e5d412f17846b0 fs/xfs/linux-2.6/xfs_ioctl32.c sandeen(a)sandeen.net 2008-11-25 495 /* Bulk copy in up to the sx_stat field, then copy bstat */
e5d412f17846b0 fs/xfs/linux-2.6/xfs_ioctl32.c sandeen(a)sandeen.net 2008-11-25 496 if (copy_from_user(&sxp, sxu,
e5d412f17846b0 fs/xfs/linux-2.6/xfs_ioctl32.c sandeen(a)sandeen.net 2008-11-25 497 offsetof(struct xfs_swapext, sx_stat)) ||
e5d412f17846b0 fs/xfs/linux-2.6/xfs_ioctl32.c sandeen(a)sandeen.net 2008-11-25 498 xfs_ioctl32_bstat_copyin(&sxp.sx_stat, &sxu->sx_stat))
b474c7ae4395ba fs/xfs/xfs_ioctl32.c Eric Sandeen 2014-06-22 499 return -EFAULT;
d9457dc0562499 fs/xfs/xfs_ioctl32.c Jan Kara 2012-06-12 @500 error = mnt_want_write_file(filp);---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
Quoted 5 lines · Darrick J. Wong
From: Darrick J. Wong <[email protected]>
Fix some compiler warnings about unused variables.
Signed-off-by Darrick J. Wong <[email protected]>
The change looks silly but otherwise ok. What compiler gives these stupid warnings?
Quoted 9 lines · Christoph Hellwig
Quoted 5 lines · Darrick J. Wong
From: Darrick J. Wong <[email protected]>
Fix some compiler warnings about unused variables.
Signed-off-by Darrick J. Wong <[email protected]>The change looks silly but otherwise ok. What compiler gives these stupid warnings?
gcc 10.3, but it doesn't matter because the kbuild robot says this patch creates even /more/ silly warnings on other weird architectures, so I'm withdrawing this patch because I DGAF^W have decided that chasing unused variable warnings is a bad use of anybody's time.
--D