Re: [PATCH RESEND v2 07/23] proc: let procfs own the seq_file of seq_file entries

From
Kees Cook <kees@kernel.org>
Date
2026-11-07 16:10:30
Also in
dri-devel, kexec, linux-acpi, linux-alpha, linux-cifs, linux-doc, linux-ext4, linux-fbdev, linux-fsdevel, linux-hwmon, linux-input, linux-kselftest, linux-m68k, linux-mm, linux-modules, linux-nfs, linux-pci, linux-s390, linux-scsi, linux-serial, linux-sh, linux-sound, linux-um, linux-usb, linux-wireless, linuxppc-dev, lkml, netdev, netfilter-devel, ntfs3, platform-driver-x86, sparclinux
Reply to
Christian Brauner, 2026-11-04

On November 4, 2026 11:30:58 AM PST, Christian Brauner [off-list ref] wrote:
[...]
+static int pde_init_seq_direct(struct proc_dir_entry *pde)
+{
+	struct seq_operations *ops;
+
+	if (!pde_is_seq_file(pde))
+		return 0;
+	ops = kmalloc(sizeof(*ops), GFP_KERNEL);
Please use the new style typed allocation calls for objects:

ops = kmalloc_obj(*ops);

(This happened to jump out at me, but please check the other patches for this pattern.)
		dp->open = kzalloc(sizeof(*dp->open), GFP_KERNEL);
Same, etc.

-- 
Kees Cook
Thread (211 messages) 211 messages, 10 authors, last reply 23d ago
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help