.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * Intel & MS High Precision Event Timer Implementation. |
---|
3 | 4 | * |
---|
.. | .. |
---|
5 | 6 | * Venki Pallipadi |
---|
6 | 7 | * (c) Copyright 2004 Hewlett-Packard Development Company, L.P. |
---|
7 | 8 | * Bob Picco <robert.picco@hp.com> |
---|
8 | | - * |
---|
9 | | - * This program is free software; you can redistribute it and/or modify |
---|
10 | | - * it under the terms of the GNU General Public License version 2 as |
---|
11 | | - * published by the Free Software Foundation. |
---|
12 | 9 | */ |
---|
13 | 10 | |
---|
14 | 11 | #include <linux/interrupt.h> |
---|
.. | .. |
---|
113 | 110 | unsigned long hp_delta; |
---|
114 | 111 | unsigned int hp_ntimer; |
---|
115 | 112 | unsigned int hp_which; |
---|
116 | | - struct hpet_dev hp_dev[1]; |
---|
| 113 | + struct hpet_dev hp_dev[]; |
---|
117 | 114 | }; |
---|
118 | 115 | |
---|
119 | 116 | static struct hpets *hpets; |
---|
.. | .. |
---|
841 | 838 | struct hpet_dev *devp; |
---|
842 | 839 | u32 i, ntimer; |
---|
843 | 840 | struct hpets *hpetp; |
---|
844 | | - size_t siz; |
---|
845 | 841 | struct hpet __iomem *hpet; |
---|
846 | 842 | static struct hpets *last; |
---|
847 | 843 | unsigned long period; |
---|
.. | .. |
---|
859 | 855 | return 0; |
---|
860 | 856 | } |
---|
861 | 857 | |
---|
862 | | - siz = sizeof(struct hpets) + ((hdp->hd_nirqs - 1) * |
---|
863 | | - sizeof(struct hpet_dev)); |
---|
864 | | - |
---|
865 | | - hpetp = kzalloc(siz, GFP_KERNEL); |
---|
| 858 | + hpetp = kzalloc(struct_size(hpetp, hp_dev, hdp->hd_nirqs), |
---|
| 859 | + GFP_KERNEL); |
---|
866 | 860 | |
---|
867 | 861 | if (!hpetp) |
---|
868 | 862 | return -ENOMEM; |
---|