public inbox for [email protected]
 help / color / mirror / Atom feed
* [ammarfaizi2-block:brauner/linux/fs.xattr.simple.rework.rbtree 1/1] fs/xattr.c:1118 simple_xattr_get() error: uninitialized symbol 'ret'.
@ 2022-11-14 12:50 Dan Carpenter
  2022-11-14 13:37 ` Christian Brauner
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2022-11-14 12:50 UTC (permalink / raw)
  To: oe-kbuild, Christian Brauner
  Cc: lkp, oe-kbuild-all, Ammar Faizi, GNU/Weeb Mailing List

tree:   https://github.com/ammarfaizi2/linux-block brauner/linux/fs.xattr.simple.rework.rbtree
head:   b1999797db0738e60ae9730fcdd5ec6dd7604cd0
commit: b1999797db0738e60ae9730fcdd5ec6dd7604cd0 [1/1] xattr: use rbtree for simple_xattrs
config: m68k-randconfig-m041-20221110
compiler: m68k-linux-gcc (GCC) 12.1.0

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <[email protected]>
| Reported-by: Dan Carpenter <[email protected]>

smatch warnings:
fs/xattr.c:1118 simple_xattr_get() error: uninitialized symbol 'ret'.

vim +/ret +1118 fs/xattr.c

38f38657444d15 Aristeu Rozanski  2012-08-23  1086  int simple_xattr_get(struct simple_xattrs *xattrs, const char *name,
38f38657444d15 Aristeu Rozanski  2012-08-23  1087  		     void *buffer, size_t size)
38f38657444d15 Aristeu Rozanski  2012-08-23  1088  {
b1999797db0738 Christian Brauner 2022-11-04  1089  	struct simple_xattr *xattr = NULL;
b1999797db0738 Christian Brauner 2022-11-04  1090  	struct rb_node *rbp;
b1999797db0738 Christian Brauner 2022-11-04  1091  	int ret, seq = 0;
b1999797db0738 Christian Brauner 2022-11-04  1092  
b1999797db0738 Christian Brauner 2022-11-04  1093  	rcu_read_lock();
b1999797db0738 Christian Brauner 2022-11-04  1094  	do {
b1999797db0738 Christian Brauner 2022-11-04  1095  		read_seqbegin_or_lock(&xattrs->lock, &seq);
b1999797db0738 Christian Brauner 2022-11-04  1096  		rbp = rcu_dereference(xattrs->rb_root.rb_node);
b1999797db0738 Christian Brauner 2022-11-04  1097  		while (rbp) {
b1999797db0738 Christian Brauner 2022-11-04  1098  			xattr = rb_entry(rbp, struct simple_xattr, rb_node);
b1999797db0738 Christian Brauner 2022-11-04  1099  			if (strcmp(xattr->name, name) < 0) {
b1999797db0738 Christian Brauner 2022-11-04  1100  				rbp = rcu_dereference(rbp->rb_left);
b1999797db0738 Christian Brauner 2022-11-04  1101  			} else if (strcmp(xattr->name, name) > 0) {
b1999797db0738 Christian Brauner 2022-11-04  1102  				rbp = rcu_dereference(rbp->rb_right);
b1999797db0738 Christian Brauner 2022-11-04  1103  			} else {
38f38657444d15 Aristeu Rozanski  2012-08-23  1104  				ret = xattr->size;
38f38657444d15 Aristeu Rozanski  2012-08-23  1105  				if (buffer) {
38f38657444d15 Aristeu Rozanski  2012-08-23  1106  					if (size < xattr->size)
38f38657444d15 Aristeu Rozanski  2012-08-23  1107  						ret = -ERANGE;
38f38657444d15 Aristeu Rozanski  2012-08-23  1108  					else
38f38657444d15 Aristeu Rozanski  2012-08-23  1109  						memcpy(buffer, xattr->value, xattr->size);
38f38657444d15 Aristeu Rozanski  2012-08-23  1110  				}
38f38657444d15 Aristeu Rozanski  2012-08-23  1111  				break;

"ret" is only initialized if we find "xattr->name == name".

38f38657444d15 Aristeu Rozanski  2012-08-23  1112  			}
b1999797db0738 Christian Brauner 2022-11-04  1113  		}
b1999797db0738 Christian Brauner 2022-11-04  1114  	} while (need_seqretry(&xattrs->lock, seq));
b1999797db0738 Christian Brauner 2022-11-04  1115  	done_seqretry(&xattrs->lock, seq);
b1999797db0738 Christian Brauner 2022-11-04  1116  	rcu_read_unlock();
b1999797db0738 Christian Brauner 2022-11-04  1117  
38f38657444d15 Aristeu Rozanski  2012-08-23 @1118  	return ret;
38f38657444d15 Aristeu Rozanski  2012-08-23  1119  }

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp


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

* Re: [ammarfaizi2-block:brauner/linux/fs.xattr.simple.rework.rbtree 1/1] fs/xattr.c:1118 simple_xattr_get() error: uninitialized symbol 'ret'.
  2022-11-14 12:50 [ammarfaizi2-block:brauner/linux/fs.xattr.simple.rework.rbtree 1/1] fs/xattr.c:1118 simple_xattr_get() error: uninitialized symbol 'ret' Dan Carpenter
@ 2022-11-14 13:37 ` Christian Brauner
  0 siblings, 0 replies; 2+ messages in thread
From: Christian Brauner @ 2022-11-14 13:37 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: oe-kbuild, lkp, oe-kbuild-all, Ammar Faizi, GNU/Weeb Mailing List

On Mon, Nov 14, 2022 at 03:50:41PM +0300, Dan Carpenter wrote:
> tree:   https://github.com/ammarfaizi2/linux-block brauner/linux/fs.xattr.simple.rework.rbtree
> head:   b1999797db0738e60ae9730fcdd5ec6dd7604cd0
> commit: b1999797db0738e60ae9730fcdd5ec6dd7604cd0 [1/1] xattr: use rbtree for simple_xattrs
> config: m68k-randconfig-m041-20221110
> compiler: m68k-linux-gcc (GCC) 12.1.0
> 
> If you fix the issue, kindly add following tag where applicable
> | Reported-by: kernel test robot <[email protected]>
> | Reported-by: Dan Carpenter <[email protected]>
> 
> smatch warnings:
> fs/xattr.c:1118 simple_xattr_get() error: uninitialized symbol 'ret'.
> 
> vim +/ret +1118 fs/xattr.c
> 
> 38f38657444d15 Aristeu Rozanski  2012-08-23  1086  int simple_xattr_get(struct simple_xattrs *xattrs, const char *name,
> 38f38657444d15 Aristeu Rozanski  2012-08-23  1087  		     void *buffer, size_t size)
> 38f38657444d15 Aristeu Rozanski  2012-08-23  1088  {
> b1999797db0738 Christian Brauner 2022-11-04  1089  	struct simple_xattr *xattr = NULL;
> b1999797db0738 Christian Brauner 2022-11-04  1090  	struct rb_node *rbp;
> b1999797db0738 Christian Brauner 2022-11-04  1091  	int ret, seq = 0;
> b1999797db0738 Christian Brauner 2022-11-04  1092  
> b1999797db0738 Christian Brauner 2022-11-04  1093  	rcu_read_lock();
> b1999797db0738 Christian Brauner 2022-11-04  1094  	do {
> b1999797db0738 Christian Brauner 2022-11-04  1095  		read_seqbegin_or_lock(&xattrs->lock, &seq);
> b1999797db0738 Christian Brauner 2022-11-04  1096  		rbp = rcu_dereference(xattrs->rb_root.rb_node);
> b1999797db0738 Christian Brauner 2022-11-04  1097  		while (rbp) {
> b1999797db0738 Christian Brauner 2022-11-04  1098  			xattr = rb_entry(rbp, struct simple_xattr, rb_node);
> b1999797db0738 Christian Brauner 2022-11-04  1099  			if (strcmp(xattr->name, name) < 0) {
> b1999797db0738 Christian Brauner 2022-11-04  1100  				rbp = rcu_dereference(rbp->rb_left);
> b1999797db0738 Christian Brauner 2022-11-04  1101  			} else if (strcmp(xattr->name, name) > 0) {
> b1999797db0738 Christian Brauner 2022-11-04  1102  				rbp = rcu_dereference(rbp->rb_right);
> b1999797db0738 Christian Brauner 2022-11-04  1103  			} else {
> 38f38657444d15 Aristeu Rozanski  2012-08-23  1104  				ret = xattr->size;
> 38f38657444d15 Aristeu Rozanski  2012-08-23  1105  				if (buffer) {
> 38f38657444d15 Aristeu Rozanski  2012-08-23  1106  					if (size < xattr->size)
> 38f38657444d15 Aristeu Rozanski  2012-08-23  1107  						ret = -ERANGE;
> 38f38657444d15 Aristeu Rozanski  2012-08-23  1108  					else
> 38f38657444d15 Aristeu Rozanski  2012-08-23  1109  						memcpy(buffer, xattr->value, xattr->size);
> 38f38657444d15 Aristeu Rozanski  2012-08-23  1110  				}
> 38f38657444d15 Aristeu Rozanski  2012-08-23  1111  				break;
> 
> "ret" is only initialized if we find "xattr->name == name".

Hey Dan,

Thanks for the report but fwiw, this version of the patchset hasn't made
it. We went with what's in -next currently. So that bug should be gone!

Thank you!
Christian

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

end of thread, other threads:[~2022-11-14 13:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-14 12:50 [ammarfaizi2-block:brauner/linux/fs.xattr.simple.rework.rbtree 1/1] fs/xattr.c:1118 simple_xattr_get() error: uninitialized symbol 'ret' Dan Carpenter
2022-11-14 13:37 ` Christian Brauner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox