All of lore.kernel.org
 help / color / mirror / Atom feed
* fs/nfs/nfs42xdr.c:1131 decode_read_plus() warn: missing error code? 'status'
@ 2023-05-01 21:38 kernel test robot
  0 siblings, 0 replies; 3+ messages in thread
From: kernel test robot @ 2023-05-01 21:38 UTC (permalink / raw)
  To: oe-kbuild; +Cc: lkp, Dan Carpenter

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
CC: linux-kernel@vger.kernel.org
TO: Anna Schumaker <Anna.Schumaker@Netapp.com>
CC: Trond Myklebust <trond.myklebust@hammerspace.com>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   58390c8ce1bddb6c623f62e7ed36383e7fa5c02f
commit: d3b00a802c845a6021148ce2e669b5a0b5729959 NFS: Replace the READ_PLUS decoding code
date:   9 months ago
:::::: branch date: 25 hours ago
:::::: commit date: 9 months ago
config: openrisc-randconfig-m031-20230430 (https://download.01.org/0day-ci/archive/20230502/202305020503.VqyfBBUI-lkp@intel.com/config)
compiler: or1k-linux-gcc (GCC) 12.1.0

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Link: https://lore.kernel.org/r/202305020503.VqyfBBUI-lkp@intel.com/

New smatch warnings:
fs/nfs/nfs42xdr.c:1131 decode_read_plus() warn: missing error code? 'status'
fs/nfs/nfs42xdr.c:1147 decode_read_plus() warn: potential spectre issue 'segs' [r]

Old smatch warnings:
fs/nfs/nfs4xdr.c:1194 encode_attrs() error: we previously assumed 'umask' could be null (see line 1103)
fs/nfs/nfs4xdr.c:3328 decode_attr_type() warn: potential spectre issue 'nfs_type2fmt' [w] (local cap)
fs/nfs/nfs42xdr.c:624 decode_listxattrs() warn: potential spectre issue 'buf' [w]

vim +/status +1131 fs/nfs/nfs42xdr.c

c05eafad6b0347 Anna Schumaker  2019-03-28  1107  
c567552612ece7 Anna Schumaker  2014-05-28  1108  static int decode_read_plus(struct xdr_stream *xdr, struct nfs_pgio_res *res)
c567552612ece7 Anna Schumaker  2014-05-28  1109  {
82f98c8b116bd7 Trond Myklebust 2020-12-08  1110  	struct nfs_pgio_header *hdr =
82f98c8b116bd7 Trond Myklebust 2020-12-08  1111  		container_of(res, struct nfs_pgio_header, res);
82f98c8b116bd7 Trond Myklebust 2020-12-08  1112  	struct nfs_pgio_args *args = &hdr->args;
d3b00a802c845a Anna Schumaker  2022-07-21  1113  	uint32_t segments;
d3b00a802c845a Anna Schumaker  2022-07-21  1114  	struct read_plus_segment *segs;
bff049a3b5001e Anna Schumaker  2020-04-01  1115  	int status, i;
d3b00a802c845a Anna Schumaker  2022-07-21  1116  	char scratch_buf[16];
c567552612ece7 Anna Schumaker  2014-05-28  1117  	__be32 *p;
c567552612ece7 Anna Schumaker  2014-05-28  1118  
c567552612ece7 Anna Schumaker  2014-05-28  1119  	status = decode_op_hdr(xdr, OP_READ_PLUS);
c567552612ece7 Anna Schumaker  2014-05-28  1120  	if (status)
c567552612ece7 Anna Schumaker  2014-05-28  1121  		return status;
c567552612ece7 Anna Schumaker  2014-05-28  1122  
c567552612ece7 Anna Schumaker  2014-05-28  1123  	p = xdr_inline_decode(xdr, 4 + 4);
c567552612ece7 Anna Schumaker  2014-05-28  1124  	if (unlikely(!p))
c567552612ece7 Anna Schumaker  2014-05-28  1125  		return -EIO;
c567552612ece7 Anna Schumaker  2014-05-28  1126  
1ee6310119a5b4 Trond Myklebust 2020-12-08  1127  	res->count = 0;
d3b00a802c845a Anna Schumaker  2022-07-21  1128  	res->eof = be32_to_cpup(p++);
c567552612ece7 Anna Schumaker  2014-05-28  1129  	segments = be32_to_cpup(p++);
c567552612ece7 Anna Schumaker  2014-05-28  1130  	if (segments == 0)
d3b00a802c845a Anna Schumaker  2022-07-21 @1131  		return status;
c567552612ece7 Anna Schumaker  2014-05-28  1132  
d3b00a802c845a Anna Schumaker  2022-07-21  1133  	segs = kmalloc_array(segments, sizeof(*segs), GFP_KERNEL);
d3b00a802c845a Anna Schumaker  2022-07-21  1134  	if (!segs)
d3b00a802c845a Anna Schumaker  2022-07-21  1135  		return -ENOMEM;
c567552612ece7 Anna Schumaker  2014-05-28  1136  
d3b00a802c845a Anna Schumaker  2022-07-21  1137  	xdr_set_scratch_buffer(xdr, &scratch_buf, 32);
d3b00a802c845a Anna Schumaker  2022-07-21  1138  	status = -EIO;
d3b00a802c845a Anna Schumaker  2022-07-21  1139  	for (i = 0; i < segments; i++) {
d3b00a802c845a Anna Schumaker  2022-07-21  1140  		status = decode_read_plus_segment(xdr, &segs[i]);
bff049a3b5001e Anna Schumaker  2020-04-01  1141  		if (status < 0)
d3b00a802c845a Anna Schumaker  2022-07-21  1142  			goto out;
bff049a3b5001e Anna Schumaker  2020-04-01  1143  	}
c567552612ece7 Anna Schumaker  2014-05-28  1144  
d3b00a802c845a Anna Schumaker  2022-07-21  1145  	xdr_set_pagelen(xdr, xdr_align_size(args->count));
d3b00a802c845a Anna Schumaker  2022-07-21  1146  	for (i = segments; i > 0; i--)
d3b00a802c845a Anna Schumaker  2022-07-21 @1147  		res->count += process_read_plus_segment(xdr, args, res, &segs[i-1]);
d3b00a802c845a Anna Schumaker  2022-07-21  1148  	status = 0;
d3b00a802c845a Anna Schumaker  2022-07-21  1149  
c567552612ece7 Anna Schumaker  2014-05-28  1150  out:
d3b00a802c845a Anna Schumaker  2022-07-21  1151  	kfree(segs);
d3b00a802c845a Anna Schumaker  2022-07-21  1152  	return status;
c567552612ece7 Anna Schumaker  2014-05-28  1153  }
c567552612ece7 Anna Schumaker  2014-05-28  1154  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests

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

* fs/nfs/nfs42xdr.c:1131 decode_read_plus() warn: missing error code? 'status'
@ 2023-05-22 15:04 kernel test robot
  0 siblings, 0 replies; 3+ messages in thread
From: kernel test robot @ 2023-05-22 15:04 UTC (permalink / raw)
  To: oe-kbuild; +Cc: lkp, Dan Carpenter

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
CC: linux-kernel@vger.kernel.org
TO: Anna Schumaker <Anna.Schumaker@Netapp.com>
CC: Trond Myklebust <trond.myklebust@hammerspace.com>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   44c026a73be8038f03dbdeef028b642880cf1511
commit: d3b00a802c845a6021148ce2e669b5a0b5729959 NFS: Replace the READ_PLUS decoding code
date:   10 months ago
:::::: branch date: 18 hours ago
:::::: commit date: 10 months ago
config: microblaze-randconfig-m041-20230522 (https://download.01.org/0day-ci/archive/20230522/202305222209.6l5VM2lL-lkp@intel.com/config)
compiler: microblaze-linux-gcc (GCC) 12.1.0

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Closes: https://lore.kernel.org/r/202305222209.6l5VM2lL-lkp@intel.com/

New smatch warnings:
fs/nfs/nfs42xdr.c:1131 decode_read_plus() warn: missing error code? 'status'
fs/nfs/nfs42xdr.c:1147 decode_read_plus() warn: potential spectre issue 'segs' [r]

Old smatch warnings:
fs/nfs/nfs4xdr.c:1194 encode_attrs() error: we previously assumed 'umask' could be null (see line 1103)
arch/microblaze/include/asm/thread_info.h:85 current_thread_info() error: uninitialized symbol 'sp'.
fs/nfs/nfs42xdr.c:624 decode_listxattrs() warn: potential spectre issue 'buf' [w]

vim +/status +1131 fs/nfs/nfs42xdr.c

c05eafad6b0347 Anna Schumaker  2019-03-28  1107  
c567552612ece7 Anna Schumaker  2014-05-28  1108  static int decode_read_plus(struct xdr_stream *xdr, struct nfs_pgio_res *res)
c567552612ece7 Anna Schumaker  2014-05-28  1109  {
82f98c8b116bd7 Trond Myklebust 2020-12-08  1110  	struct nfs_pgio_header *hdr =
82f98c8b116bd7 Trond Myklebust 2020-12-08  1111  		container_of(res, struct nfs_pgio_header, res);
82f98c8b116bd7 Trond Myklebust 2020-12-08  1112  	struct nfs_pgio_args *args = &hdr->args;
d3b00a802c845a Anna Schumaker  2022-07-21  1113  	uint32_t segments;
d3b00a802c845a Anna Schumaker  2022-07-21  1114  	struct read_plus_segment *segs;
bff049a3b5001e Anna Schumaker  2020-04-01  1115  	int status, i;
d3b00a802c845a Anna Schumaker  2022-07-21  1116  	char scratch_buf[16];
c567552612ece7 Anna Schumaker  2014-05-28  1117  	__be32 *p;
c567552612ece7 Anna Schumaker  2014-05-28  1118  
c567552612ece7 Anna Schumaker  2014-05-28  1119  	status = decode_op_hdr(xdr, OP_READ_PLUS);
c567552612ece7 Anna Schumaker  2014-05-28  1120  	if (status)
c567552612ece7 Anna Schumaker  2014-05-28  1121  		return status;
c567552612ece7 Anna Schumaker  2014-05-28  1122  
c567552612ece7 Anna Schumaker  2014-05-28  1123  	p = xdr_inline_decode(xdr, 4 + 4);
c567552612ece7 Anna Schumaker  2014-05-28  1124  	if (unlikely(!p))
c567552612ece7 Anna Schumaker  2014-05-28  1125  		return -EIO;
c567552612ece7 Anna Schumaker  2014-05-28  1126  
1ee6310119a5b4 Trond Myklebust 2020-12-08  1127  	res->count = 0;
d3b00a802c845a Anna Schumaker  2022-07-21  1128  	res->eof = be32_to_cpup(p++);
c567552612ece7 Anna Schumaker  2014-05-28  1129  	segments = be32_to_cpup(p++);
c567552612ece7 Anna Schumaker  2014-05-28  1130  	if (segments == 0)
d3b00a802c845a Anna Schumaker  2022-07-21 @1131  		return status;
c567552612ece7 Anna Schumaker  2014-05-28  1132  
d3b00a802c845a Anna Schumaker  2022-07-21  1133  	segs = kmalloc_array(segments, sizeof(*segs), GFP_KERNEL);
d3b00a802c845a Anna Schumaker  2022-07-21  1134  	if (!segs)
d3b00a802c845a Anna Schumaker  2022-07-21  1135  		return -ENOMEM;
c567552612ece7 Anna Schumaker  2014-05-28  1136  
d3b00a802c845a Anna Schumaker  2022-07-21  1137  	xdr_set_scratch_buffer(xdr, &scratch_buf, 32);
d3b00a802c845a Anna Schumaker  2022-07-21  1138  	status = -EIO;
d3b00a802c845a Anna Schumaker  2022-07-21  1139  	for (i = 0; i < segments; i++) {
d3b00a802c845a Anna Schumaker  2022-07-21  1140  		status = decode_read_plus_segment(xdr, &segs[i]);
bff049a3b5001e Anna Schumaker  2020-04-01  1141  		if (status < 0)
d3b00a802c845a Anna Schumaker  2022-07-21  1142  			goto out;
bff049a3b5001e Anna Schumaker  2020-04-01  1143  	}
c567552612ece7 Anna Schumaker  2014-05-28  1144  
d3b00a802c845a Anna Schumaker  2022-07-21  1145  	xdr_set_pagelen(xdr, xdr_align_size(args->count));
d3b00a802c845a Anna Schumaker  2022-07-21  1146  	for (i = segments; i > 0; i--)
d3b00a802c845a Anna Schumaker  2022-07-21 @1147  		res->count += process_read_plus_segment(xdr, args, res, &segs[i-1]);
d3b00a802c845a Anna Schumaker  2022-07-21  1148  	status = 0;
d3b00a802c845a Anna Schumaker  2022-07-21  1149  
c567552612ece7 Anna Schumaker  2014-05-28  1150  out:
d3b00a802c845a Anna Schumaker  2022-07-21  1151  	kfree(segs);
d3b00a802c845a Anna Schumaker  2022-07-21  1152  	return status;
c567552612ece7 Anna Schumaker  2014-05-28  1153  }
c567552612ece7 Anna Schumaker  2014-05-28  1154  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

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

* fs/nfs/nfs42xdr.c:1131 decode_read_plus() warn: missing error code? 'status'
@ 2023-05-22 15:22 Dan Carpenter
  0 siblings, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2023-05-22 15:22 UTC (permalink / raw)
  To: oe-kbuild, Anna Schumaker
  Cc: lkp, oe-kbuild-all, linux-kernel, Trond Myklebust

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   44c026a73be8038f03dbdeef028b642880cf1511
commit: d3b00a802c845a6021148ce2e669b5a0b5729959 NFS: Replace the READ_PLUS decoding code
config: microblaze-randconfig-m041-20230522 (https://download.01.org/0day-ci/archive/20230522/202305222209.6l5VM2lL-lkp@intel.com/config)
compiler: microblaze-linux-gcc (GCC) 12.1.0

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Closes: https://lore.kernel.org/r/202305222209.6l5VM2lL-lkp@intel.com/

New smatch warnings:
fs/nfs/nfs42xdr.c:1131 decode_read_plus() warn: missing error code? 'status'

Old smatch warnings:
fs/nfs/nfs4xdr.c:1194 encode_attrs() error: we previously assumed 'umask' could be null (see line 1103)

vim +/status +1131 fs/nfs/nfs42xdr.c

c567552612ece7 Anna Schumaker  2014-05-28  1108  static int decode_read_plus(struct xdr_stream *xdr, struct nfs_pgio_res *res)
c567552612ece7 Anna Schumaker  2014-05-28  1109  {
82f98c8b116bd7 Trond Myklebust 2020-12-08  1110  	struct nfs_pgio_header *hdr =
82f98c8b116bd7 Trond Myklebust 2020-12-08  1111  		container_of(res, struct nfs_pgio_header, res);
82f98c8b116bd7 Trond Myklebust 2020-12-08  1112  	struct nfs_pgio_args *args = &hdr->args;
d3b00a802c845a Anna Schumaker  2022-07-21  1113  	uint32_t segments;
d3b00a802c845a Anna Schumaker  2022-07-21  1114  	struct read_plus_segment *segs;
bff049a3b5001e Anna Schumaker  2020-04-01  1115  	int status, i;
d3b00a802c845a Anna Schumaker  2022-07-21  1116  	char scratch_buf[16];
c567552612ece7 Anna Schumaker  2014-05-28  1117  	__be32 *p;
c567552612ece7 Anna Schumaker  2014-05-28  1118  
c567552612ece7 Anna Schumaker  2014-05-28  1119  	status = decode_op_hdr(xdr, OP_READ_PLUS);
c567552612ece7 Anna Schumaker  2014-05-28  1120  	if (status)
c567552612ece7 Anna Schumaker  2014-05-28  1121  		return status;
c567552612ece7 Anna Schumaker  2014-05-28  1122  
c567552612ece7 Anna Schumaker  2014-05-28  1123  	p = xdr_inline_decode(xdr, 4 + 4);
c567552612ece7 Anna Schumaker  2014-05-28  1124  	if (unlikely(!p))
c567552612ece7 Anna Schumaker  2014-05-28  1125  		return -EIO;
c567552612ece7 Anna Schumaker  2014-05-28  1126  
1ee6310119a5b4 Trond Myklebust 2020-12-08  1127  	res->count = 0;
d3b00a802c845a Anna Schumaker  2022-07-21  1128  	res->eof = be32_to_cpup(p++);
c567552612ece7 Anna Schumaker  2014-05-28  1129  	segments = be32_to_cpup(p++);
c567552612ece7 Anna Schumaker  2014-05-28  1130  	if (segments == 0)
d3b00a802c845a Anna Schumaker  2022-07-21 @1131  		return status;

This looks like intentional?  It's probably better to to do a literal
"return 0;"  Makes the static checkers happy.

c567552612ece7 Anna Schumaker  2014-05-28  1132  
d3b00a802c845a Anna Schumaker  2022-07-21  1133  	segs = kmalloc_array(segments, sizeof(*segs), GFP_KERNEL);
d3b00a802c845a Anna Schumaker  2022-07-21  1134  	if (!segs)
d3b00a802c845a Anna Schumaker  2022-07-21  1135  		return -ENOMEM;
c567552612ece7 Anna Schumaker  2014-05-28  1136  
d3b00a802c845a Anna Schumaker  2022-07-21  1137  	xdr_set_scratch_buffer(xdr, &scratch_buf, 32);
d3b00a802c845a Anna Schumaker  2022-07-21  1138  	status = -EIO;

This assignment is not used.

d3b00a802c845a Anna Schumaker  2022-07-21  1139  	for (i = 0; i < segments; i++) {
d3b00a802c845a Anna Schumaker  2022-07-21  1140  		status = decode_read_plus_segment(xdr, &segs[i]);
bff049a3b5001e Anna Schumaker  2020-04-01  1141  		if (status < 0)
d3b00a802c845a Anna Schumaker  2022-07-21  1142  			goto out;
bff049a3b5001e Anna Schumaker  2020-04-01  1143  	}
c567552612ece7 Anna Schumaker  2014-05-28  1144  
d3b00a802c845a Anna Schumaker  2022-07-21  1145  	xdr_set_pagelen(xdr, xdr_align_size(args->count));
d3b00a802c845a Anna Schumaker  2022-07-21  1146  	for (i = segments; i > 0; i--)
d3b00a802c845a Anna Schumaker  2022-07-21 @1147  		res->count += process_read_plus_segment(xdr, args, res, &segs[i-1]);
d3b00a802c845a Anna Schumaker  2022-07-21  1148  	status = 0;
d3b00a802c845a Anna Schumaker  2022-07-21  1149  
c567552612ece7 Anna Schumaker  2014-05-28  1150  out:
d3b00a802c845a Anna Schumaker  2022-07-21  1151  	kfree(segs);
d3b00a802c845a Anna Schumaker  2022-07-21  1152  	return status;
c567552612ece7 Anna Schumaker  2014-05-28  1153  }

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki


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

end of thread, other threads:[~2023-05-22 15:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-01 21:38 fs/nfs/nfs42xdr.c:1131 decode_read_plus() warn: missing error code? 'status' kernel test robot
  -- strict thread matches above, loose matches on Subject: below --
2023-05-22 15:04 kernel test robot
2023-05-22 15:22 Dan Carpenter

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.