A field in files_struct has been used without initialization

From: Abd-Alrhman Masalkhi
Date: Thu Oct 06 2022 - 06:46:02 EST


Hello Linux community,

I have came acrose the following code in dup_fd()

1 newf = kmem_cache_alloc(files_cachep, GFP_KERNEL);
2 if (!newf)
3 goto out;
4
5 atomic_set(&newf->count, 1);
6
7 spin_lock_init(&newf->file_lock);
8 newf->resize_in_progress = false;
9 init_waitqueue_head(&newf->resize_wait);
10 newf->next_fd = 0;
11 new_fdt = &newf->fdtab;
12 new_fdt->max_fds = NR_OPEN_DEFAULT;
13 new_fdt->close_on_exec = newf->close_on_exec_init;

On line 13 new_fdt->close_on_exec has given the value of
newf->close_on_exec_init, but new_fdt->close_on_exec itself has not
been initialized, is it intended to be like this.

Thanky you very much!