tree:
https://git.kernel.org/pub/scm/linux/kernel/git/rppt/linux.git secretmemfd/v3
head: 807167124581cd8d39ff386e86fb5f138e650e26
commit: a7c74dfbd307d0fdde021d1da82bccbdd69655cc [3/6] mm: introduce memfd_secret system
call to create "secret" memory areas
compiler: riscv64-linux-gcc (GCC) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
cppcheck warnings: (new ones prefixed by >>)
> mm/secretmem.c:166:7: warning: Variable 'file' is
reassigned a value before the old one has been used. [redundantAssignment]
file
= alloc_file_pseudo(inode, secretmem_mnt, "secretmem",
^
mm/secretmem.c:154:0: note: Variable 'file' is reassigned a value before the
old one has been used.
struct file *file = ERR_PTR(-ENOMEM);
^
mm/secretmem.c:166:7: note: Variable 'file' is reassigned a value before the
old one has been used.
file = alloc_file_pseudo(inode, secretmem_mnt, "secretmem",
^
#
https://git.kernel.org/pub/scm/linux/kernel/git/rppt/linux.git/commit/?id...
git remote add rppt
https://git.kernel.org/pub/scm/linux/kernel/git/rppt/linux.git
git fetch --no-tags rppt secretmemfd/v3
git checkout a7c74dfbd307d0fdde021d1da82bccbdd69655cc
vim +/file +166 mm/secretmem.c
151
152 static struct file *secretmem_file_create(unsigned long flags)
153 {
154 struct file *file = ERR_PTR(-ENOMEM);
155 struct secretmem_ctx *ctx;
156 struct inode *inode;
157
158 inode = alloc_anon_inode(secretmem_mnt->mnt_sb);
159 if (IS_ERR(inode))
160 return ERR_CAST(inode);
161
162 ctx = kzalloc(sizeof(*ctx), GFP_KERNEL);
163 if (!ctx)
164 goto err_free_inode;
165
166 file = alloc_file_pseudo(inode, secretmem_mnt,
"secretmem",
167 O_RDWR, &secretmem_fops);
168 if (IS_ERR(file))
169 goto err_free_ctx;
170
171 mapping_set_unevictable(inode->i_mapping);
172
173 inode->i_mapping->private_data = ctx;
174 inode->i_mapping->a_ops = &secretmem_aops;
175
176 /* pretend we are a normal file with zero size */
177 inode->i_mode |= S_IFREG;
178 inode->i_size = 0;
179
180 file->private_data = ctx;
181
182 ctx->mode = flags & SECRETMEM_MODE_MASK;
183
184 return file;
185
186 err_free_ctx:
187 kfree(ctx);
188 err_free_inode:
189 iput(inode);
190 return file;
191 }
192
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org