| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * irqchip.c: Common API for in kernel interrupt controllers |
|---|
| 3 | 4 | * Copyright (c) 2007, Intel Corporation. |
|---|
| 4 | 5 | * Copyright 2010 Red Hat, Inc. and/or its affiliates. |
|---|
| 5 | 6 | * Copyright (c) 2013, Alexander Graf <agraf@suse.de> |
|---|
| 6 | | - * |
|---|
| 7 | | - * This program is free software; you can redistribute it and/or modify it |
|---|
| 8 | | - * under the terms and conditions of the GNU General Public License, |
|---|
| 9 | | - * version 2, as published by the Free Software Foundation. |
|---|
| 10 | | - * |
|---|
| 11 | | - * This program is distributed in the hope it will be useful, but WITHOUT |
|---|
| 12 | | - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|---|
| 13 | | - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
|---|
| 14 | | - * more details. |
|---|
| 15 | | - * |
|---|
| 16 | | - * You should have received a copy of the GNU General Public License along with |
|---|
| 17 | | - * this program; if not, write to the Free Software Foundation, Inc., 59 Temple |
|---|
| 18 | | - * Place - Suite 330, Boston, MA 02111-1307 USA. |
|---|
| 19 | 7 | * |
|---|
| 20 | 8 | * This file is derived from virt/kvm/irq_comm.c. |
|---|
| 21 | 9 | * |
|---|
| .. | .. |
|---|
| 196 | 184 | |
|---|
| 197 | 185 | nr_rt_entries += 1; |
|---|
| 198 | 186 | |
|---|
| 199 | | - new = kzalloc(sizeof(*new) + (nr_rt_entries * sizeof(struct hlist_head)), |
|---|
| 200 | | - GFP_KERNEL); |
|---|
| 201 | | - |
|---|
| 187 | + new = kzalloc(struct_size(new, map, nr_rt_entries), GFP_KERNEL_ACCOUNT); |
|---|
| 202 | 188 | if (!new) |
|---|
| 203 | 189 | return -ENOMEM; |
|---|
| 204 | 190 | |
|---|
| .. | .. |
|---|
| 209 | 195 | |
|---|
| 210 | 196 | for (i = 0; i < nr; ++i) { |
|---|
| 211 | 197 | r = -ENOMEM; |
|---|
| 212 | | - e = kzalloc(sizeof(*e), GFP_KERNEL); |
|---|
| 198 | + e = kzalloc(sizeof(*e), GFP_KERNEL_ACCOUNT); |
|---|
| 213 | 199 | if (!e) |
|---|
| 214 | 200 | goto out; |
|---|
| 215 | 201 | |
|---|