diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2026-02-21 11:02:58 -0800 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2026-02-21 11:02:58 -0800 |
| commit | 8934827db5403eae57d4537114a9ff88b0a8460f (patch) | |
| tree | 5167aa7e16b786b9135e19d508b234054fa6e8ce /drivers/net/hyperv | |
| parent | c7decec2f2d2ab0366567f9e30c0e1418cece43f (diff) | |
| parent | 7a70c15bd1449f1eb30991772edce37b41e496fb (diff) | |
Merge tag 'kmalloc_obj-treewide-v7.0-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux
Pull kmalloc_obj conversion from Kees Cook:
"This does the tree-wide conversion to kmalloc_obj() and friends using
coccinelle, with a subsequent small manual cleanup of whitespace
alignment that coccinelle does not handle.
This uncovered a clang bug in __builtin_counted_by_ref(), so the
conversion is preceded by disabling that for current versions of
clang. The imminent clang 22.1 release has the fix.
I've done allmodconfig build tests for x86_64, arm64, i386, and arm. I
did defconfig builds for alpha, m68k, mips, parisc, powerpc, riscv,
s390, sparc, sh, arc, csky, xtensa, hexagon, and openrisc"
* tag 'kmalloc_obj-treewide-v7.0-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux:
kmalloc_obj: Clean up after treewide replacements
treewide: Replace kmalloc with kmalloc_obj for non-scalar types
compiler_types: Disable __builtin_counted_by_ref for Clang
Diffstat (limited to 'drivers/net/hyperv')
| -rw-r--r-- | drivers/net/hyperv/netvsc.c | 7 | ||||
| -rw-r--r-- | drivers/net/hyperv/netvsc_drv.c | 9 | ||||
| -rw-r--r-- | drivers/net/hyperv/rndis_filter.c | 4 |
3 files changed, 9 insertions, 11 deletions
diff --git a/drivers/net/hyperv/netvsc.c b/drivers/net/hyperv/netvsc.c index 60a4629fe6ba..d9fa2fc4c43c 100644 --- a/drivers/net/hyperv/netvsc.c +++ b/drivers/net/hyperv/netvsc.c @@ -129,7 +129,7 @@ static struct netvsc_device *alloc_net_device(void) { struct netvsc_device *net_device; - net_device = kzalloc(sizeof(struct netvsc_device), GFP_KERNEL); + net_device = kzalloc_obj(struct netvsc_device, GFP_KERNEL); if (!net_device) return NULL; @@ -1025,9 +1025,8 @@ static int netvsc_dma_map(struct hv_device *hv_dev, if (!hv_is_isolation_supported()) return 0; - packet->dma_range = kcalloc(page_count, - sizeof(*packet->dma_range), - GFP_ATOMIC); + packet->dma_range = kzalloc_objs(*packet->dma_range, page_count, + GFP_ATOMIC); if (!packet->dma_range) return -ENOMEM; diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c index cbd52cb79268..1a3f2a35519f 100644 --- a/drivers/net/hyperv/netvsc_drv.c +++ b/drivers/net/hyperv/netvsc_drv.c @@ -712,7 +712,7 @@ void netvsc_linkstatus_callback(struct net_device *net, if (net->reg_state != NETREG_REGISTERED) return; - event = kzalloc(sizeof(*event), GFP_ATOMIC); + event = kzalloc_obj(*event, GFP_ATOMIC); if (!event) return; event->event = indicate->status; @@ -931,7 +931,7 @@ struct netvsc_device_info *netvsc_devinfo_get(struct netvsc_device *nvdev) struct netvsc_device_info *dev_info; struct bpf_prog *prog; - dev_info = kzalloc(sizeof(*dev_info), GFP_ATOMIC); + dev_info = kzalloc_obj(*dev_info, GFP_ATOMIC); if (!dev_info) return NULL; @@ -1524,9 +1524,8 @@ static void netvsc_get_ethtool_stats(struct net_device *dev, data[i++] = xdp_tx; } - pcpu_sum = kvmalloc_array(nr_cpu_ids, - sizeof(struct netvsc_ethtool_pcpu_stats), - GFP_KERNEL); + pcpu_sum = kvmalloc_objs(struct netvsc_ethtool_pcpu_stats, nr_cpu_ids, + GFP_KERNEL); if (!pcpu_sum) return; diff --git a/drivers/net/hyperv/rndis_filter.c b/drivers/net/hyperv/rndis_filter.c index c35f9685b6bf..2fa77dc21d7e 100644 --- a/drivers/net/hyperv/rndis_filter.c +++ b/drivers/net/hyperv/rndis_filter.c @@ -64,7 +64,7 @@ static struct rndis_device *get_rndis_device(void) { struct rndis_device *device; - device = kzalloc(sizeof(struct rndis_device), GFP_KERNEL); + device = kzalloc_obj(struct rndis_device, GFP_KERNEL); if (!device) return NULL; @@ -87,7 +87,7 @@ static struct rndis_request *get_rndis_request(struct rndis_device *dev, struct rndis_set_request *set; unsigned long flags; - request = kzalloc(sizeof(struct rndis_request), GFP_KERNEL); + request = kzalloc_obj(struct rndis_request, GFP_KERNEL); if (!request) return NULL; |
