Skip to content

Commit 129a45f

Browse files
Darrick J. WongMiklos Szeredi
authored andcommitted
fuse: quiet down complaints in fuse_conn_limit_write
gcc 15 complains about an uninitialized variable val that is passed by reference into fuse_conn_limit_write: control.c: In function ‘fuse_conn_congestion_threshold_write’: include/asm-generic/rwonce.h:55:37: warning: ‘val’ may be used uninitialized [-Wmaybe-uninitialized] 55 | *(volatile typeof(x) *)&(x) = (val); \ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~ include/asm-generic/rwonce.h:61:9: note: in expansion of macro ‘__WRITE_ONCE’ 61 | __WRITE_ONCE(x, val); \ | ^~~~~~~~~~~~ control.c:178:9: note: in expansion of macro ‘WRITE_ONCE’ 178 | WRITE_ONCE(fc->congestion_threshold, val); | ^~~~~~~~~~ control.c:166:18: note: ‘val’ was declared here 166 | unsigned val; | ^~~ Unfortunately there's enough macro spew involved in kstrtoul_from_user that I think gcc gives up on its analysis and sprays the above warning. AFAICT it's not actually a bug, but we could just zero-initialize the variable to enable using -Wmaybe-uninitialized to find real problems. Previously we would use some weird uninitialized_var annotation to quiet down the warnings, so clearly this code has been like this for quite some time. Cc: stable@vger.kernel.org # v5.9 Fixes: 3f649ab ("treewide: Remove uninitialized_var() usage") Signed-off-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
1 parent f595dda commit 129a45f

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

fs/fuse/control.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ static ssize_t fuse_conn_max_background_write(struct file *file,
121121
const char __user *buf,
122122
size_t count, loff_t *ppos)
123123
{
124-
unsigned val;
124+
unsigned int val = 0;
125125
ssize_t ret;
126126

127127
ret = fuse_conn_limit_write(file, buf, count, ppos, &val,
@@ -163,7 +163,7 @@ static ssize_t fuse_conn_congestion_threshold_write(struct file *file,
163163
const char __user *buf,
164164
size_t count, loff_t *ppos)
165165
{
166-
unsigned val;
166+
unsigned int val = 0;
167167
struct fuse_conn *fc;
168168
ssize_t ret;
169169

0 commit comments

Comments
 (0)