diff options
| author | Kees Cook <kees@kernel.org> | 2026-02-21 23:46:04 -0800 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2026-02-22 08:26:33 -0800 |
| commit | 189f164e573e18d9f8876dbd3ad8fcbe11f93037 (patch) | |
| tree | 733382723a15ea29b7c9f3dde3bcb281f0b3c287 /drivers/media | |
| parent | 32a92f8c89326985e05dce8b22d3f0aa07a3e1bd (diff) | |
Convert remaining multi-line kmalloc_obj/flex GFP_KERNEL usesHEADtorvalds/mastertorvalds/HEADmaster
Conversion performed via this Coccinelle script:
// SPDX-License-Identifier: GPL-2.0-only
// Options: --include-headers-for-types --all-includes --include-headers --keep-comments
virtual patch
@gfp depends on patch && !(file in "tools") && !(file in "samples")@
identifier ALLOC = {kmalloc_obj,kmalloc_objs,kmalloc_flex,
kzalloc_obj,kzalloc_objs,kzalloc_flex,
kvmalloc_obj,kvmalloc_objs,kvmalloc_flex,
kvzalloc_obj,kvzalloc_objs,kvzalloc_flex};
@@
ALLOC(...
- , GFP_KERNEL
)
$ make coccicheck MODE=patch COCCI=gfp.cocci
Build and boot tested x86_64 with Fedora 42's GCC and Clang:
Linux version 6.19.0+ (user@host) (gcc (GCC) 15.2.1 20260123 (Red Hat 15.2.1-7), GNU ld version 2.44-12.fc42) #1 SMP PREEMPT_DYNAMIC 1970-01-01
Linux version 6.19.0+ (user@host) (clang version 20.1.8 (Fedora 20.1.8-4.fc42), LLD 20.1.8) #1 SMP PREEMPT_DYNAMIC 1970-01-01
Signed-off-by: Kees Cook <kees@kernel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/media')
| -rw-r--r-- | drivers/media/pci/tw686x/tw686x-core.c | 4 | ||||
| -rw-r--r-- | drivers/media/usb/pvrusb2/pvrusb2-hdw.c | 2 | ||||
| -rw-r--r-- | drivers/media/v4l2-core/v4l2-subdev.c | 3 |
3 files changed, 4 insertions, 5 deletions
diff --git a/drivers/media/pci/tw686x/tw686x-core.c b/drivers/media/pci/tw686x/tw686x-core.c index 101c7ccc6fd0..a10e38221817 100644 --- a/drivers/media/pci/tw686x/tw686x-core.c +++ b/drivers/media/pci/tw686x/tw686x-core.c @@ -251,14 +251,14 @@ static int tw686x_probe(struct pci_dev *pci_dev, sprintf(dev->name, "tw%04X", pci_dev->device); dev->video_channels = kzalloc_objs(*dev->video_channels, - max_channels(dev), GFP_KERNEL); + max_channels(dev)); if (!dev->video_channels) { err = -ENOMEM; goto free_dev; } dev->audio_channels = kzalloc_objs(*dev->audio_channels, - max_channels(dev), GFP_KERNEL); + max_channels(dev)); if (!dev->audio_channels) { err = -ENOMEM; goto free_video; diff --git a/drivers/media/usb/pvrusb2/pvrusb2-hdw.c b/drivers/media/usb/pvrusb2/pvrusb2-hdw.c index 4d3f5f863030..3c270ef00752 100644 --- a/drivers/media/usb/pvrusb2/pvrusb2-hdw.c +++ b/drivers/media/usb/pvrusb2/pvrusb2-hdw.c @@ -2450,7 +2450,7 @@ struct pvr2_hdw *pvr2_hdw_create(struct usb_interface *intf, /* Define and configure additional controls from cx2341x module. */ hdw->mpeg_ctrl_info = kzalloc_objs(*(hdw->mpeg_ctrl_info), - MPEGDEF_COUNT, GFP_KERNEL); + MPEGDEF_COUNT); if (!hdw->mpeg_ctrl_info) goto fail; for (idx = 0; idx < MPEGDEF_COUNT; idx++) { cptr = hdw->controls + idx + CTRLDEF_COUNT; diff --git a/drivers/media/v4l2-core/v4l2-subdev.c b/drivers/media/v4l2-core/v4l2-subdev.c index 1beb9d3f1f1e..32e6f60e26c7 100644 --- a/drivers/media/v4l2-core/v4l2-subdev.c +++ b/drivers/media/v4l2-core/v4l2-subdev.c @@ -1889,8 +1889,7 @@ v4l2_subdev_init_stream_configs(struct v4l2_subdev_stream_configs *stream_config if (new_configs.num_configs) { new_configs.configs = kvzalloc_objs(*new_configs.configs, - new_configs.num_configs, - GFP_KERNEL); + new_configs.num_configs); if (!new_configs.configs) return -ENOMEM; |
