Re: [PATCH 09/11] treewide: Convert custom kernel_param_ops .get callbacks to seq_buf via cocci

3 views
Skip to first unread message

Sean Christopherson

unread,
May 21, 2026, 11:11:26 AMMay 21
to Kees Cook, Luis Chamberlain, Pengpeng Hou, Petr Pavlu, Richard Weinberger, Anton Ivanov, Johannes Berg, Rafael J. Wysocki, Len Brown, Corey Minyard, Gabriel Somlo, Michael S. Tsirkin, Jani Nikula, Joonas Lahtinen, Rodrigo Vivi, Tvrtko Ursulin, David Airlie, Simona Vetter, Bart Van Assche, Jason Gunthorpe, Leon Romanovsky, Laurent Pinchart, Hans de Goede, Mauro Carvalho Chehab, Bjorn Helgaas, Hannes Reinecke, James E.J. Bottomley, Martin K. Petersen, Daniel Lezcano, Zhang Rui, Lukasz Luba, Greg Kroah-Hartman, Jiri Slaby, Alan Stern, Jason Wang, Xuan Zhuo, Eugenio Pérez, Jason Baron, Jim Cromie, Tiwei Bie, Benjamin Berg, Ilpo Järvinen, David E. Box, Maciej W. Rozycki, Srinivas Pandruvada, Peter Zijlstra, Heiko Carstens, Vasily Gorbik, Paolo Bonzini, Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen, x...@kernel.org, H. Peter Anvin, Vinod Koul, Frank Li, Daniel Gomez, Sami Tolvanen, Aaron Tomlin, Alexander Potapenko, Marco Elver, Dmitry Vyukov, Andrew Morton, John Johansen, Paul Moore, James Morris, Serge E. Hallyn, Andy Shevchenko, Georgia Garcia, k...@vger.kernel.org, dmae...@vger.kernel.org, linux-...@vger.kernel.org, kasa...@googlegroups.com, linu...@kvack.org, appa...@lists.ubuntu.com, linux-secu...@vger.kernel.org, linu...@lists.infradead.org, linux...@vger.kernel.org, openipmi-...@lists.sourceforge.net, qemu-...@nongnu.org, inte...@lists.freedesktop.org, dri-...@lists.freedesktop.org, linux...@vger.kernel.org, linux...@vger.kernel.org, linu...@vger.kernel.org, linux...@vger.kernel.org, linu...@vger.kernel.org, linuxp...@lists.ozlabs.org, linux-...@vger.kernel.org, linu...@vger.kernel.org, usb-s...@lists.one-eyed-alien.net, virtual...@lists.linux.dev, linux-...@vger.kernel.org, linux...@vger.kernel.org, net...@vger.kernel.org, linux-...@vger.kernel.org, linux-h...@vger.kernel.org
On Thu, May 21, 2026, Kees Cook wrote:
> diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
> index 07f4c7209ac0..00317774a90b 100644
> --- a/arch/x86/kvm/vmx/vmx.c
> +++ b/arch/x86/kvm/vmx/vmx.c
> @@ -368,12 +368,16 @@ static int vmentry_l1d_flush_set(const char *s, const struct kernel_param *kp)
> return ret;
> }
>
> -static int vmentry_l1d_flush_get(char *s, const struct kernel_param *kp)
> +static int vmentry_l1d_flush_get(struct seq_buf *s,
> + const struct kernel_param *kp)
> {
> - if (WARN_ON_ONCE(l1tf_vmx_mitigation >= ARRAY_SIZE(vmentry_l1d_param)))
> - return sysfs_emit(s, "???\n");
> + if (WARN_ON_ONCE(l1tf_vmx_mitigation >= ARRAY_SIZE(vmentry_l1d_param))) {
> + seq_buf_printf(s, "???\n");
> + return 0;
> + }
>
> - return sysfs_emit(s, "%s\n", vmentry_l1d_param[l1tf_vmx_mitigation].option);
> + seq_buf_printf(s, "%s\n", vmentry_l1d_param[l1tf_vmx_mitigation].option);
> + return 0;

For this one, can you manually change it to this?

if (WARN_ON_ONCE(l1tf_vmx_mitigation >= ARRAY_SIZE(vmentry_l1d_param)))
seq_buf_printf(s, "???\n");
else
seq_buf_printf(s, "%s\n", vmentry_l1d_param[l1tf_vmx_mitigation].option);
return 0;

> }
>
> /*
> @@ -459,9 +463,11 @@ static int vmentry_l1d_flush_set(const char *s, const struct kernel_param *kp)
> pr_warn_once("Kernel compiled without mitigations, ignoring vmentry_l1d_flush\n");
> return 0;
> }
> -static int vmentry_l1d_flush_get(char *s, const struct kernel_param *kp)
> +static int vmentry_l1d_flush_get(struct seq_buf *s,
> + const struct kernel_param *kp)
> {
> - return sysfs_emit(s, "never\n");
> + seq_buf_printf(s, "never\n");
> + return 0;
> }
> #endif
Reply all
Reply to author
Forward
0 new messages